I am using a multi-select mod (and have used it many times in the past very successfully). For my new project, I am having an issue where my multiple selections are not being logged into the database. Only the first item I select in the list is being captured.
Here is my code:
sub build_sizes {
# --------------------------------------------------------
#
# To call this subroutine from html_record_form, use the following syntax:
#
# print &build_sizes("Sizes",$rec{'Sizes'});
#
# Be sure to express the field name *exactly* as it is defined in your .cfg file.
#
$size = "8";
my $field = $_[0];
my $compare = $_[1];
my %selector = (
'Sizes' => [
['1.0','1.0'],
['1.5','1.5'],
['2.0','2.0'],
['2.5','2.5'],
['3.0','3.0'],
['3.5','3.5'],
['4.0','4.0'],
['5.0','5.0'],
]
);
$output = qq|<SELECT NAME="$field" MULTIPLE SIZE="$size">\n|;
$i = 0;
while ( $selector{$field}[$i][0] ) {
$compare =~/$selector{$field}[$i][0]/ ?
($output .= qq|<OPTION VALUE="$selector{$field}[$i][0]" SELECTED>$selector{$field}[$i][1]\n|) :
($output .= qq|<OPTION VALUE="$selector{$field}[$i][0]">$selector{$field}[$i][1]\n|);
++$i;
}
if ($i) {
$output .= "</SELECT>";
}
else {
$output = "Incorrect field definition";
}
return $output;
}
In past use, the database would capture somethng like this: 1.0~~2.0~~2.5
Again, now it is only capturing my first selection. Is there something I need to add or modify in any of the subs in the db.cgi file or am I missing something else. Please help. My brain is fried trying to figure out what is wrong.
Thanks!
Here is my code:
sub build_sizes {
# --------------------------------------------------------
#
# To call this subroutine from html_record_form, use the following syntax:
#
# print &build_sizes("Sizes",$rec{'Sizes'});
#
# Be sure to express the field name *exactly* as it is defined in your .cfg file.
#
$size = "8";
my $field = $_[0];
my $compare = $_[1];
my %selector = (
'Sizes' => [
['1.0','1.0'],
['1.5','1.5'],
['2.0','2.0'],
['2.5','2.5'],
['3.0','3.0'],
['3.5','3.5'],
['4.0','4.0'],
['5.0','5.0'],
]
);
$output = qq|<SELECT NAME="$field" MULTIPLE SIZE="$size">\n|;
$i = 0;
while ( $selector{$field}[$i][0] ) {
$compare =~/$selector{$field}[$i][0]/ ?
($output .= qq|<OPTION VALUE="$selector{$field}[$i][0]" SELECTED>$selector{$field}[$i][1]\n|) :
($output .= qq|<OPTION VALUE="$selector{$field}[$i][0]">$selector{$field}[$i][1]\n|);
++$i;
}
if ($i) {
$output .= "</SELECT>";
}
else {
$output = "Incorrect field definition";
}
return $output;
}
In past use, the database would capture somethng like this: 1.0~~2.0~~2.5
Again, now it is only capturing my first selection. Is there something I need to add or modify in any of the subs in the db.cgi file or am I missing something else. Please help. My brain is fried trying to figure out what is wrong.
Thanks!