rashley has asked for the wisdom of the Perl Monks concerning the following question:
I have a CGI template that dynamically creates a table based on an array of userids. Next to each userid there is a checkbox. At the bottom is a submit button.
When the submit button is clicked I need the template to send a list of the checked userids back to a CGI page. My plan is to loop through the checkboxes and cat each to a hidden field using Javascript.
Problem is, I don't know how to do any of this, since I've never used Javascript and am still fairly new to CGI.
Right now my template for the form looks something like this (I've removed a lot that isn't relavent to my question):
This displays what I want to see, but obviously doesn't do what I need it to do. I know I need a function to call onSubmit, but I don't know how to loop through a dynamically generated series of checkboxes.<body visited="red" bgcolor="#ffffff" leftmargin="0" marginwidth="0" t +opmargin="0" marginheight="0" onload="currentPage();getSortStatus();" +> <table border="0" cellpadding="0" cellspacing="0" width="100%"> {?@userids --?} <tr id="row{?$_x?}" {?if $_v!=1 --?}style="display:none"{?-- $ +_v?}> <td id="username{?$_x?}" <a name="{?$USER_FIRST_NAME?} {?$ +USER_MIDDLE_INITIAL?} {?$USER_LAST_NAME?}"></a></td> <td id="check{?_x?}" <input type="checkbox" name="printcheck" +value="on"></td> </tr> {?-- @userids?} <tr> <td><input type="submit" value="Submit"></td> </tr> </table>
So, the questions I pose to the almighty Monks are: 1. What do I need to add to the code above and 2. What will my function look like in order to pass my list of userids?
|
|---|