X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-table.html;h=127028ee58db5e4cea83327ce070790760ff5fd3;hb=a6fe07e49e3fc12169e801b1ed6874c3a5bd8500;hp=4efbcbaf3960b7af8e88a927f1b4d8de0aaa5e53;hpb=24533a22a23e211888fcc36a5177c0def5c77de3;p=freeside.git diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html index 4efbcbaf3..127028ee5 100644 --- a/httemplate/elements/select-table.html +++ b/httemplate/elements/select-table.html @@ -29,11 +29,16 @@ Example: #or 'records' => \@records, #instead of search params + #instead of the primary key... only for special cases + 'value_col' => 'columnname', + #basic params controlling the resulting @@ -44,6 +49,10 @@ Example: # %} @@ -91,9 +131,11 @@ Example: my( %opt ) = @_; -warn "elements/select-table.html: \n". Dumper(%opt) +warn "elements/select-table.html: \n". Dumper(\%opt) if exists $opt{debug} && $opt{debug}; +$opt{'extra_option_attributes'} ||= []; + my $onchange = ''; if ( $opt{'onchange'} ) { $onchange = $opt{'onchange'}; @@ -106,7 +148,7 @@ if ( $opt{'onchange'} ) { my $dbdef_table = dbdef->table($opt{'table'}) or die "can't find dbdef for ". $opt{'table'}. " table\n"; -my $key = $dbdef_table->primary_key; #? $opt{'primary_key'} || +my $key = $opt{'value_col'} || $dbdef_table->primary_key; my $name_col = $opt{'name_col'}; @@ -139,7 +181,7 @@ if ( $opt{'records'} ) { }); } -unless ( ! $value +unless ( $value < 1 # !$value #ignore negatives too or ref($value) or ! exists( $opt{hashref}->{disabled} ) #?? or grep { $value == $_->$key() } @records @@ -159,6 +201,7 @@ if ( ref( $value ) eq 'ARRAY' ) { $value = { map { $_ => 1 } @$value }; } -my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : (); +my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : (); +my @post_options = $opt{post_options} ? @{ $opt{post_options} } : ();