add disabled option to text elements
[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 my @style = ();
39
40 push @style, 'text-align: '. $opt{'text-align'}
41   if $opt{'text-align'};
42
43 push @style, 'background-color: #dddddd'
44   if $opt{'disabled'};
45
46 $opt{'disabled'} = 'DISABLED'
47   if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah?
48
49 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
50
51 my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
52
53 </%init>