In db_utils.pl search for sub build_select_field. This is the entire sub build_select_field I'm using right now:
Code:
sub build_select_field { # --------------------------------------------------------
# Builds a SELECT field based on information found
# in the database definition.
#
my ($column, $value, $name, $mult) = @_;
my ($size, %values);
$name || ($name = $column);
$size || ($size = 1);
if (! exists $db_select_fields{$column}) {
$db_select_fields{$db_cols[$db_category]} = $db_select_fields{'Mult-Related'} = join (",", &category_list);
}
if ($mult) {
@fields = split (/\,/, $db_select_fields{"Mult-$column"});
%values = map { $_ => 1 } split (/\Q$db_delim\E/, $value);
}
else {
@fields = split (/\,/, $db_select_fields{$column});
$values{$value}++;
}
($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";
$output = qq|<select class="form" name="$name" $mult size=$size><option>---|;
foreach $field (@fields) {
$kategory{$field} = &kategorie_title_mb($field);
}
foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED VALUE=\"$field\">$kategory{$field}\n") :
($output .= "<OPTION VALUE=\"$field\">$kategory{$field}");
}
$output .= "</select>";
return $output;
} sub kategorie_title_mb {
# --------------------------------------------------------
my ($input, $output, $title, $kategorie, @fields); $input = $_[0];
$title = ""; KATEGORIE: foreach $kategorie (@kategorien) {
if ($kategorie =~ /^#/) { next KATEGORIE; } # Skip comment lines.
chomp ($kategorie);
@fields = &split_decode ($kategorie);
if ($fields[1] eq $input) {
$title = $fields[8];
last KATEGORIE;
}
}
if ($title eq "") {
$output = &build_clean ($input);
}
else {
$output = &build_clean_mb ($title);
} return $output;
}
Don't forget to include the sub kategorie_title_mb below the sub build_select_field (like I did above). Otherwise the validation of new links won't work...
C.