Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Javascript select and unselect all checkboxes not working in Perl CGI code

by soonix (Canon)
on Jul 16, 2013 at 07:19 UTC ( [id://1044518]=note: print w/replies, xml ) Need Help??


in reply to Javascript select and unselect all checkboxes not working in Perl CGI code

Your javascript uses a name to access the form (which you provide), but in your call to start_form you don't give it a name.
  • Comment on Re: Javascript select and unselect all checkboxes not working in Perl CGI code

Replies are listed 'Best First'.
Re^2: Javascript select and unselect all checkboxes not working in Perl CGI code
by begood321 (Novice) on Jul 16, 2013 at 13:59 UTC

    Thanks soonix for your reply. I updated that section of code as follows from examples I've seen:

    start_form(-name=>'forms'),

    However, code still not working. Do you know correct syntax? Searching but haven't found anything PERL CGI related matching exactly call for code below:

    my $JSCRIPT=<<EOF; function selectToggle(toggle, form) { var myForm = document.forms[form]; for( var i=0; i < myForm.length; i++ ) { if(toggle) { myForm.elements[i].checked = "checked"; } else { myForm.elements[i].checked = ""; } } } EOF

    Any other ideas or suggestions?

      The name should be 'theForm' as in the links
      print a( { href => "javascript:selectToggle(true, 'theForm');" }, "All +" ); print " | "; print a( { href => "javascript:selectToggle(false, 'theForm'); +" }, "None" );
      or change the links
      poj

        Thanks Soonix, code to call form below now allows selecting all or none for all checkboxes. I owe you a beer :)

        start_form(-name=>'theForm'),

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1044518]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-24 18:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found