develooper Front page | perl.beginners | Postings from June 2012

Check parameters for a checkbox

Thread Next
From:
Mark Haney
Date:
June 11, 2012 12:51
Subject:
Check parameters for a checkbox
Message ID:
4FD64C30.9010506@abemblem.com
This might be the wrong place to post this, but since it's /sort of/ 
perl related, maybe I'll get some help.

I've got a series of checkboxes denoting the days of the week and I want 
the ones that are checked to be passed to my CGI script from the form. 
Apparently, I'm not getting the method which that checkboxes are passing 
the data.  Here's a portion of the html:

> <input type="checkbox" name="DoW" value="M"/>M <input type="checkbox" name="DoW" value="T"/>T

I thought that the values of each selected checkbox would be passed via 
the variable name 'DoW' (as in 'MTWTH' or 'MWF'), but that doesn't look 
like the case.

The data is passed to a CGI script that does this before passing to a 
sub that dumps the data to a database table:

> my %attrs = (
> 	shift_name => $q->param('shift_name'),
> 	shift_beg => $q->param('shift_beg'),
> 	shift_end => $q->param('shift_end'),
> 	factory_id => $q->param('factory'),
> 	shift_days => $q->param('DoW'),
> );

When I run the script I get this in apache's error.log:

DBIx::Class::ResultSet::new(): No such column T on

Where the 'T' is obviously the T in Tuesday since the Monday and Tuesday 
are the only two I selected.  I'm missing something simple, but I've not 
found any help on Google explaining how checkbox data is passed in a form.

Any ideas?


-- 

Mark Haney
Software Developer/Consultant
AB Emblem
markh@abemblem.com
Linux marius.homelinux 3.3.7-1.fc16.x86_64 GNU/Linux

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About