I am quite familiar with Perl generated checkboxes but I have an app which has quite a number of extras and I would rather not create a separate field in my table for each one.
I turned to checkbox-group and I have hit a snag.
Create the control and populate it from an array.
Submitting the form containing the control, sends multiple values for selected items, in the form of an array.
So far so good but by default, only the first item is stored in my table.
I can iterate through the array, and store all the values as a string containing separators but how do I repopulate the correct checkboxes when I reload the form from my table?
I am sure I could work it out with code but operations of the CGI module are usually a lot simpler than that.
Keith
I turned to checkbox-group and I have hit a snag.
Create the control and populate it from an array.
Code:
$EXTRUS= $query->checkbox_group(
-name=>'EXTRAS',
-values=> \@Extras,
-linebreak=>'true',
-default=>'');
Submitting the form containing the control, sends multiple values for selected items, in the form of an array.
Code:
my @boxes=$query->param('EXTRAS');
my $bitz;
foreach $bitz (@boxes){
print "*$bitz*";
}
I can iterate through the array, and store all the values as a string containing separators but how do I repopulate the correct checkboxes when I reload the form from my table?
I am sure I could work it out with code but operations of the CGI module are usually a lot simpler than that.
Keith