Line # Revision Author
1 3 ahitrov@rambler.ru <select <% $multiple %> <% $size %> <% $onChange %> name="<% $name %>" class="selects" style="<% $width %><% $height %><% $style %>">
2
3 % while (my ($key, $value) = splice(@local_values, 0, 2))
4 % {
5 % my $selected = (scalar grep { $_ eq $key } @local_checks ) ? ' selected' : '';
6 % next unless defined $key;
7 <option value="<% $key %>"<% $selected %>><% $value %></option>
8 % }
9
10 </select>
11 <%args>
12
13 $name => undef
14 $values => []
15 $check => undef
16 $multiple => undef
17 $size => undef
18 $onChange => undef
19
20 $width => undef
21 $height => undef
22
23 $style => undef
24
25 </%args>
26 <%init>
27
28 my @local_values = @{ $values }; # ��������, ����� �� ����������...
29 my @local_checks = ();
30 if (ref($check) eq 'ARRAY')
31 {
32 @local_checks = @{ $check };
33 } elsif (defined($check)) {
34 @local_checks = ($check);
35 }
36
37 $size = ($size) ? " size=\"$size\"" : '';
38 $width = ($width) ? "width:$width;" : '';
39 $height = ($height) ? "height:$height;" : '';
40 $multiple = ($multiple) ? ' multiple' : '';
41 $onChange = ($onChange) ? " onChange=\"$onChange\"" : '';
42
43 </%init>