Revision 4fe15703
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
SL/Template/Plugin/L.pm | ||
---|---|---|
207 | 207 |
|
208 | 208 |
my $value_title_sub = $options{value_title_sub}; |
209 | 209 |
|
210 |
my %selected = map { ( $_ => 1 ) } @{ ref($options{default}) eq 'ARRAY' ? $options{default} : $options{default} ? [ $options{default} ] : [] };
|
|
210 |
my %selected = map { ( $_ => 1 ) } @{ ref($options{default}) eq 'ARRAY' ? $options{default} : defined($options{default}) ? [ $options{default} ] : [] };
|
|
211 | 211 |
|
212 | 212 |
my $access = sub { |
213 | 213 |
my ($element, $index, $key, $sub) = @_; |
... | ... | |
231 | 231 |
my $code = ''; |
232 | 232 |
foreach my $result (@elements) { |
233 | 233 |
my %attributes = ( value => $result->[0] ); |
234 |
$attributes{selected} = 'selected' if $selected{ $result->[0] || '' };
|
|
234 |
$attributes{selected} = 'selected' if $selected{ defined($result->[0]) ? $result->[0] : '' };
|
|
235 | 235 |
|
236 | 236 |
$code .= $self->html_tag('option', _H($result->[1]), %attributes); |
237 | 237 |
} |
Auch abrufbar als: Unified diff
options_for_select: Default "0" ermöglichen