Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Can't get MULTISELECT column into modify_form.html

Quote Reply
Can't get MULTISELECT column into modify_form.html
There does not seem to be a sub generate_multiselect anywhere!

Can't work out how to adapt sub generate_select.

So how can we put a multiselect column into a custom modify_form.html?

GT: help please -- can't do a ******** thing!
Quote Reply
sub generate_multiselect -- our attempt In reply to
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.

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.

Last edited by:

YoYoYoYo: Feb 19, 2003, 7:59 AM