The field type "select+multi" does not work, albeit there is partial code support in
Form.pm
. The patch below does the rest:
*** Form.pm~ Thu Jul 20 03:18:11 2006
--- Form.pm Sun Aug 6 08:45:38 2006
***************
*** 476,487 ****
-name => $name,
-default => "\n".$value );
! } elsif( $type eq 'select' ) {
$options = $fieldDef->{value};
ASSERT( ref( $options )) if DEBUG;
my $choices = '';
foreach $item ( @$options ) {
! $selected = ( $item eq $value );
$item =~ s/<nop/<\;nop/go;
if( $selected ) {
$choices .= CGI::option({ selected=>'selected' }, $item );
--- 476,487 ----
-name => $name,
-default => "\n".$value );
! } elsif( $type =~ /select/ ) {
$options = $fieldDef->{value};
ASSERT( ref( $options )) if DEBUG;
my $choices = '';
foreach $item ( @$options ) {
! $selected = ( $value =~ /(^|,\s*)$item(\s*,|$)/ );
$item =~ s/<nop/<\;nop/go;
if( $selected ) {
$choices .= CGI::option({ selected=>'selected' }, $item );
***************
*** 489,495 ****
$choices .= CGI::option( $item );
}
}
! $value = CGI::Select( { name=>$name, size=>$size }, $choices );
} elsif( $type =~ /^checkbox/ ) {
$options = $fieldDef->{value};
--- 489,499 ----
$choices .= CGI::option( $item );
}
}
! if ( $type =~ /\+multi/ ) {
! $value = CGI::Select( { name=>$name, multiple=>undef, size=>$size }, $choices );
! } else {
! $value = CGI::Select( { name=>$name, size=>$size }, $choices );
! }
} elsif( $type =~ /^checkbox/ ) {
$options = $fieldDef->{value};
--
TW
Any reason why you do not check in this code change to SVN?
Are you not sure about the fix? Or do you not have access to the core?
--
KJL
I have been running this on our site, so I am sure. I just wanted to get feedback whether this is desired... Maybe there is some weird reason why the code did not get finished that I don't understand... --
TW
Maybe have a look at the
TWiki:Plugins.ExtendedSelectPlugin
which has
even more really useful code that cold go in here.
--
MD
Excellent suggestion. This plugin is a rather small, but very usefull enhancement to
TWikiForms, and can be made slightly more consistent when integrated. The only feature I wonder about is "select+shrink". --
TW
Finally got around to doing this. Handled shrink rather differently, using a range on the size (a solution not available to plugins).
CC
4.1.0 released
KJL