Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

by soonix (Curate)
on Jul 16, 2013 at 07:19 UTC ( #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
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
Node Status?
node history
Node Type: note [id://1044518]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-12-26 10:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls