bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monasterians,
I like HTML::FillInForm, but I've discovered a problem populating multiple checkboxes. There was an example given here, but because I'm validating and doing stuff with all the values, I really can't use %fdat = $q->Vars; (besides, I don't know if I'm really doing anything differently with the hash anyway). Here's what I've tried
HTML: <input type="checkbox" name="typeofinfo" value="1" /> Program<br /> <input type="checkbox" name="typeofinfo" value="2" /> Abstracts<br /> <input type="checkbox" name="typeofinfo" value="3" /> Exhibits<br /> <input type="checkbox" name="typeofinfo" value="4" /> Registration<br +/> PERL: $fillinformvalues = { typeofinfo => $query->param('typeofinfo') } my $form = new HTML::FillInForm; my $page = $form->fill( scalarref => \$html, fdat => $fillinformvalues ); print $page;
It only checks the first box that was checked. I used to do it with HTML::Template in a more convoluted way, but it worked.
USING H::T <input type="checkbox" name="typeofinfo" value="1" <tmpl_if type1>chec +ked </tmpl_if>/> Program<br /> <input type="checkbox" name="typeofinfo" value="2" <tmpl_if type2>chec +ked </tmpl_if>/> Abstracts<br /> PERL: { no strict 'subs'; for my $i (0 .. $#$typeofinfo) { $template -> param( type.$typeofinfo->[$i] => 1 ) } } print $template->output;
Is there a way to make my code work with multiple checkboxes? Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can HTML::FillInForm handle multiple checkboxes?
by borisz (Canon) on Aug 05, 2005 at 15:14 UTC | |
by ikegami (Patriarch) on Aug 05, 2005 at 15:17 UTC | |
by bradcathey (Prior) on Aug 05, 2005 at 16:51 UTC | |
by tinita (Parson) on Aug 05, 2005 at 15:26 UTC | |
|
Re: Can HTML::FillInForm handle multiple checkboxes?
by trammell (Priest) on Aug 05, 2005 at 16:17 UTC |