I am trying to install a mod by Rick Guyer to put a text field beside a select field in case selections are not complete.
In db.cgi after
if ($value eq "---") { next PAIR; }
I added this line
unless ($value) { next PAIR; }
I added this subroutine to db.cgi
sub beside_select_field {
# --------------------------------------------------------
# Used for placing a text box next to a select field. If the $value isn't in the array, then it prints the $value in the text box.
my ($column, $value, $size) = @_;
my (@fields, $ouptut, $tmp);
@fields = split (/\,/, $db_select_fields{$column});
if ($#fields == -1) {
$output = "error building select field: no select fields specified in config for field '$column'!";
}
else {
$output = qq|<input name="$column" size="$size"|;
foreach $field (@fields) {
if ($value eq $field) {
$output .=">";
return $output;
}
else {$tmp=1;}
}
if ($tmp=1) {
$output .=" value=\"$value\">";
}
}
return $output;
}
I added this line to my html_record_form, right after the select field.
print &beside_select_field ("House Type", "$rec{'House Type'}", "$db_form_len{'20'}");
When adding a record, if nothing is selected in the select box but input something into the text box, I encounter this error saying the "House Type (the field name) should not be blank". It seems the input in the text field can not be passed. I double checked my field name and other things to be sure they are correct. Any clue will be greatly appreciated.
Long
In db.cgi after
if ($value eq "---") { next PAIR; }
I added this line
unless ($value) { next PAIR; }
I added this subroutine to db.cgi
sub beside_select_field {
# --------------------------------------------------------
# Used for placing a text box next to a select field. If the $value isn't in the array, then it prints the $value in the text box.
my ($column, $value, $size) = @_;
my (@fields, $ouptut, $tmp);
@fields = split (/\,/, $db_select_fields{$column});
if ($#fields == -1) {
$output = "error building select field: no select fields specified in config for field '$column'!";
}
else {
$output = qq|<input name="$column" size="$size"|;
foreach $field (@fields) {
if ($value eq $field) {
$output .=">";
return $output;
}
else {$tmp=1;}
}
if ($tmp=1) {
$output .=" value=\"$value\">";
}
}
return $output;
}
I added this line to my html_record_form, right after the select field.
print &beside_select_field ("House Type", "$rec{'House Type'}", "$db_form_len{'20'}");
When adding a record, if nothing is selected in the select box but input something into the text box, I encounter this error saying the "House Type (the field name) should not be blank". It seems the input in the text field can not be passed. I double checked my field name and other things to be sure they are correct. Any clue will be greatly appreciated.
Long