I'm sure this is covered somewhere in the forum, but I didn't see it.
If I want to produce the following:
AND
with the same function,
I believe the call would read something like this:
and the sub would read:
# --------------------------------------------------------
# Builds a SELECT field based on information found
# in the database definition. Parameters are the column to build
# and a default value (optional).
my ($column, $value, $attributes) = @_;
my (@fields, $ouptut);
@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|<SELECT NAME="$column" $attributes><OPTION>---\n|;
foreach $field (@fields) {
$field eq $value ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field\n");
}
$output .= "</SELECT>";
}
return $output;
}
I haven't tried it yet but am I on the right track?
beetleman
Marcus L. Griswold
If I want to produce the following:
Code:
<SELECT NAME="FIELD_22" ONCHANGE="functionName('FIELD_22', 'VALUE_2', 'VALUE_3')"><OPTION>--- etc. ...Code:
<SELECT NAME="FIELD_28" ONCHANGE="functionName('FIELD_28', 'VALUE_4', 'VALUE_7')"><OPTION>--- etc. ...I believe the call would read something like this:
Code:
|; print &build_select_field ("FIELD_22", "$rec{'FIELD_22'}","ONCHANGE=\"functionName('FIELD_28', 'VALUE_4', 'VALUE_7')\"" ); print qq|Code:
sub build_select_field { # --------------------------------------------------------
# Builds a SELECT field based on information found
# in the database definition. Parameters are the column to build
# and a default value (optional).
my ($column, $value, $attributes) = @_;
my (@fields, $ouptut);
@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|<SELECT NAME="$column" $attributes><OPTION>---\n|;
foreach $field (@fields) {
$field eq $value ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field\n");
}
$output .= "</SELECT>";
}
return $output;
}
I haven't tried it yet but am I on the right track?
beetleman
Marcus L. Griswold