How about doing something like the following:
assuming you have the following in your links.def file
Colors => [16, 'alpha', 0, 35, 0, '', 'Blue|Green|Brown|Black|Other'],
and
Code:
%db_select_fields = (
isNew => 'Yes,No',
isPopular => 'Yes,No',
isMonthPopular => 'Yes,No',
ReceiveMail => 'Yes,No',
Colors => 'Blue,Green,Brown,Black,Other'
);
Then in your add.html
Code:
<select name="
Colors" MULTIPLE Size="5">
<option value="Blue">Blue</option>
<option value="Green">Green</option>
<option value="Brown">Brown</option>
<option value="Black">Black</option>
<option value="Other">Other</option>
</select>
And in modify.html ( I think you need the enhanced template.pm parseer for this )
Code:
<select name="
Colors" MULTIPLE Size="5">
<OPTION value="Blue"<%if
Colors eq 'Blue'%> SELECTED<%endif%>>Blue</OPTION>
<OPTION value="Green"<%if
Colors eq 'Green'%> SELECTED<%endif%>>Green</OPTION>
<OPTION value="Brown"<%if
Colors eq 'Brown'%> SELECTED<%endif%>>Brown</OPTION>
<OPTION value="Black"<%if
Colors eq 'Black'%> SELECTED<%endif%>>Black</OPTION>
<OPTION value="Other"<%if
Colors eq 'Other'%> SELECTED<%endif%>>Other</OPTION>
</select>
Then in db_utils.pl
Code:
sub build_html_record_form {
# --------------------------------------------------------
# Builds a record form based on the config information.
#
my ($output, $field, $multiple, $name);
($_[0] eq "multiple") and ($multiple = 1) and shift;
my (%rec) = @_; $output = "<p><table border=1>"; # Go through a little hoops to only load category list when absolutely neccessary.
if ($in{'db'} eq 'links') {
exists $db_select_fields{$db_cols[$db_category]}
or ($db_select_fields{$db_cols[$db_category]} = join (",", &category_list));
($db_select_fields{$db_cols[$db_colors]} = $db_select_fields{'Mult-Colors'} = join (",", "Blue,Green,Brown,Black,Other")); }
else {
$db_select_fields{'Related'} or
($db_select_fields{'Related'} = $db_select_fields{'Mult-Related'} = join ",", &category_list);
}
Now for the hard part, which I am going to have to work on ( or maybe one of the gurus could do this part ). In the nph-build.cgi ( search.cgi? ) you will need to split the
Colors field. Probably after the split_decode. This routine changes the way the data is stored in the database ( Blue~~Brown~~Other ) and the way it looks after the split_decode ( Blue|Brown|Other ).
But it is late and I am tired and I have to concentrate when I use the split function.
But try this:
in site_html_templates:
Code:
sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like.
my %rec = @_;
$rec{'Colors'} =~ s,\|,\, ,g; etc, etc
then in your site.html page add:
<%
Colors%>
Ouch! I need a new brain to do this. Hey, paul/sponge, help me out here!!!
If you want to do it in the detailed page, just put the $rec{'Colors'} line above in the
return &load_template ('detailed.html', { line of the sub site_html_detailed routine in the site_html_templates.pl
Gene "The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."