new package editor
[freeside.git] / httemplate / elements / tr-input-text.html
1 <% include('tr-td-label.html', @_ ) %>
2
3   <TD <% $cell_style %>>
4
5     <% $opt{'prefix'} %><INPUT TYPE  = "<% $opt{type} || 'text' %>"
6                                NAME  = "<% $opt{field} %>"
7                                ID    = "<% $opt{id} %>"
8                                VALUE = "<% $value |h %>"
9                                <% $size %>
10                                <% $maxlength %>
11                                <% $style %>
12                                <% $opt{disabled} %>
13                                <% $onchange %>
14                         ><% $opt{'postfix'} %>
15
16   </TD>
17
18 </TR>
19
20 <%init>
21
22 my %opt = @_;
23
24 my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};
25
26 my $onchange = $opt{'onchange'}
27                  ? 'onChange="'. $opt{'onchange'}. '(this)"'
28                  : '';
29
30 my $size = $opt{'size'}
31              ? 'SIZE="'. $opt{'size'}. '"'
32              : '';
33
34 my $maxlength = $opt{'maxlength'}
35                 ? 'MAXLENGTH="'. $opt{'maxlength'}. '"'
36                 : '';
37
38 $opt{'disabled'} = &{ $opt{'disabled'} }( \%opt )
39   if ref($opt{'disabled'}) eq 'CODE';
40 $opt{'disabled'} = 'DISABLED'
41   if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah?
42
43 my @style = ();
44
45 push @style, 'text-align: '. $opt{'text-align'}
46   if $opt{'text-align'};
47
48 push @style, 'background-color: #dddddd'
49   if $opt{'disabled'};
50
51 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
52
53 my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
54
55 </%init>