1 |
3 |
ahitrov@rambler.ru |
<select name="<% $name %>"<% $prop->{multiple} && ' multiple' %><% $prop->{size} && ' size="'.$prop->{size}.'"' %>> |
2 |
|
|
% |
3 |
|
|
% if ($prop->{allow_null}) { |
4 |
|
|
% |
5 |
|
|
<option value="" <% defined $check ? '' : 'selected' %>>--- �� ������� ---</option> |
6 |
|
|
% |
7 |
|
|
% } |
8 |
|
|
% |
9 |
|
|
% for my $chain (@chains) { |
10 |
|
|
% |
11 |
|
|
% my $selected = defined $chain && ( ref $check eq 'ARRAY' ? grep { $_ eq $chain } @$check : $check eq $chain ? 1 : 0 ); |
12 |
|
|
% $found++ if $selected; |
13 |
|
|
% |
14 |
|
|
<option value="<% $chain %>"<% $selected && ' selected' %>><% $chain %></option> |
15 |
|
|
% |
16 |
|
|
% } |
17 |
|
|
% |
18 |
|
|
% #if used not allowed value |
19 |
|
|
% if ( $check and not $found ) { |
20 |
|
|
% |
21 |
|
|
<option value="<% $check %>" selected style="color:red;"><% $check %></option> |
22 |
|
|
% |
23 |
|
|
% } |
24 |
|
|
% |
25 |
|
|
</select> |
26 |
|
|
<%args> |
27 |
|
|
|
28 |
|
|
$prop => undef |
29 |
|
|
$name => undef |
30 |
|
|
$values => [] |
31 |
|
|
$check => undef |
32 |
|
|
$options => undef |
33 |
|
|
|
34 |
|
|
</%args> |
35 |
|
|
<%init> |
36 |
|
|
|
37 |
|
|
my $found = 0; |
38 |
|
|
my @chains = (); |
39 |
|
|
|
40 |
|
|
if ( ref $options && exists $options->{$name} ) { |
41 |
|
|
@chains = @{ $options->{$name} }; |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
</%init> |