diff options
Diffstat (limited to 'httemplate/elements/select-table.html')
-rw-r--r-- | httemplate/elements/select-table.html | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html index c0dde7414..127028ee5 100644 --- a/httemplate/elements/select-table.html +++ b/httemplate/elements/select-table.html @@ -93,10 +93,17 @@ Example: % ) % { % my $recvalue = $record->$key(); +% my $selected; +% if ( $opt{'all_selected'} ) { +% $selected = 1; +% } elsif ( $opt{'compare_sub'} && !ref($value) ) { +% $selected = &{ $opt{'compare_sub'} }( $value, $recvalue ); +% } else { +% $selected = ( ref($value) && $value->{$recvalue} ) +% || ( $value && $value eq $recvalue ); #not == because of value_col +% } <OPTION VALUE="<% $recvalue %>" - <% $opt{'all_selected'} || ref($value) && $value->{$recvalue} || $value && $value eq $recvalue # not == because of value_col - ? ' SELECTED' : '' - %> + <% $selected ? ' SELECTED' : '' %> % foreach my $att ( @{ $opt{'extra_option_attributes'} } ) { data-<% $att %>="<% $record->$att() |h %>" % } |