<% include('tr-td-label.html', @_ ) %>
- <TD <% $style %>>
+ <TD <% $cell_style %>>
<% $opt{'prefix'} %><INPUT TYPE = "<% $opt{type} || 'text' %>"
NAME = "<% $opt{field} %>"
ID = "<% $opt{id} %>"
- VALUE = "<% $opt{curr_value} || $opt{value} %>"
+ VALUE = "<% $value |h %>"
<% $size %>
+ <% $maxlength %>
+ <% $style %>
+ <% $opt{disabled} %>
<% $onchange %>
- >
+ ><% $opt{'postfix'} %>
</TD>
my %opt = @_;
+my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};
+
my $onchange = $opt{'onchange'}
? 'onChange="'. $opt{'onchange'}. '(this)"'
: '';
? 'SIZE="'. $opt{'size'}. '"'
: '';
-my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+my $maxlength = $opt{'maxlength'}
+ ? 'MAXLENGTH="'. $opt{'maxlength'}. '"'
+ : '';
+
+$opt{'disabled'} = &{ $opt{'disabled'} }( \%opt )
+ if ref($opt{'disabled'}) eq 'CODE';
+$opt{'disabled'} = 'DISABLED'
+ if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah?
+
+my @style = ();
+
+push @style, 'text-align: '. $opt{'text-align'}
+ if $opt{'text-align'};
+
+push @style, 'background-color: #dddddd'
+ if $opt{'disabled'};
+
+my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
+
+my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
</%init>