|Don't ask to ask, just ask|
Converting large numbers of checkboxes to small number of paramsby MrCromeDome (Deacon)
|on Jul 09, 2003 at 20:14 UTC||Need Help??|
MrCromeDome has asked for the wisdom of the Perl Monks concerning the following question:
A dear friend of mine has recruited me to assist her with a project for the community college she works for. The end result of the project is a several page web application that tests a student's abilities to perform basic tasks on the Internet (filling out forms, following links, e-mailing, etc.). I pretty much have a handle on the project, but one piece of it is still managing to elude me.
A sample of the form that is giving me a headache can be seen at http://www.cromedome.net/test01.html. The "time matrix" is to be filled out by the student - submitting of the form takes adds that information to our database and presents the student with the next part of the application. The problem is that I'm trying to come up with the most efficient way of generating and extracting information from that form (the form must remain in that general format). Here's what I've come up with, but none of these options seem too appealing at present:
1) Create a checkbox for each cell of the table. Have one parameter for each checkbox on the form. Manually check each one of these checkboxes and update the database with the appropriate information. This is obviously the method I like least.
2) Create a checkbox for each cell of the table. Iterate through the list of all parameters to our script, and extract information for only those parameters that are checkboxes. Update the database with the appropriate information. Seems much more manageable than #1, but there's still the tedium of creating each individual checkbox on the form.
3) Use Perl and CGI.pm to programmatically generate groups of checkboxes, one group for each day. This seems a slick way of doing it, but how can I produce a checkbox group where each checkbox is in it's own table cell? The only way I know how to do something similar would be to create one checkbox group for each timeslot, then use the linebreak property to print the checkbox for each day on it's own line. But that seems cheesy.
In all the Perl and web programming I've done, I've never really had to work with this complex of a form before. I guess what I'm looking for is any insight that you might have for me. What's the best way to construct this form? What's the best way to extract the parameters that submitting the form will produce? I'm not the person who will ultimately be supporting this, so simpler is definitely better.
Thanks in advance,