Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: CGI Table with checkboxes

by TJPride (Pilgrim)
on Apr 13, 2013 at 06:29 UTC ( [id://1028490]=note: print w/replies, xml ) Need Help??


in reply to CGI Table with checkboxes

Why do this with Perl at all? Why can't you just use Javascript to display / fill in the values? Something like:
<html> <head> <title>Checkboxes to Textarea</title> <script type="text/javascript"> function refactor() { var f = document.forms.myform; var s = []; for (var i = 1; i <= 3; i++) if (f.elements['C'+i].checked) s.push(f.elements['C'+i].value); f.command.value = s.join(' '); document.getElementById('command_div').style.display = s.length > 0 ? '' : 'none'; } </script> </head> <body bgcolor="white"> <form name="myform" method="post" action=""> <div id="command_div" style="margin-bottom: 15px; display: none;"> <textarea name="command" rows="3" cols="50"></textarea> </div> <input type="checkbox" name="C1" value="Command 1" onclick="refactor() +;"> Checked Command 1 <input type="checkbox" name="C2" value="Command 2" onclick="refactor() +;"> Checked Command 2 <input type="checkbox" name="C3" value="Command 3" onclick="refactor() +;"> Checked Command 3 </form> </body> </html>
I'm assuming of course that the command is for display purposes only, and will not be submitted directly to the system. You have to be very careful with that sort of thing even if you're filtering it through Perl first.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2026-02-13 22:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.