in reply to CGI Table with checkboxes
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.<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>
|
|---|