OK, we are desperate ... so we have tried to figure it out for ourselves. We don't have the technical background for this sort of thing -- occasional programmers (not in Perl), not software engineers -- so we would be delighted to be told that the sub below has no obvious flaws or side-effects.
Code:
sub generate_multiselect {
#-------------------------------------------------------------------
# Generate automatically a multiselect box for a field which form type is multiple
# $col: multiple-select field name
#
my $col = shift;
my $tags = GT::Template->tags;
my $cols = $tags->{home}->{db}->cols;
( lc $cols->{$col}->{'form_type'} eq 'multiple' ) or return;
my $selected = $tags->{values}->{$col};
my $values = $cols->{$col}->{'form_values'};
my $names = $cols->{$col}->{'form_names'};
my $multi = $cols->{$col}->{'form_size'};
return $tags->{home}->{disp}->multiple( {
name => $col,
values => $values,
value => $selected,
multiple => $multi,
blank => 1
});
}
We have learnt to be suspicious when code works the first time, so we would be even more delighted to be told candidly what is wrong with it.