add disabled option to text elements
[freeside.git] / httemplate / elements / tr-input-text.html
index ac21cb5..49ae166 100644 (file)
@@ -1,14 +1,17 @@
 <% 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>
 
@@ -18,6 +21,8 @@
 
 my %opt = @_;
 
+my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};
+
 my $onchange = $opt{'onchange'}
                  ? 'onChange="'. $opt{'onchange'}. '(this)"'
                  : '';
@@ -26,6 +31,23 @@ my $size = $opt{'size'}
              ? 'SIZE="'. $opt{'size'}. '"'
              : '';
 
-my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+my $maxlength = $opt{'maxlength'}
+                ? 'MAXLENGTH="'. $opt{'maxlength'}. '"'
+                : '';
+
+my @style = ();
+
+push @style, 'text-align: '. $opt{'text-align'}
+  if $opt{'text-align'};
+
+push @style, 'background-color: #dddddd'
+  if $opt{'disabled'};
+
+$opt{'disabled'} = 'DISABLED'
+  if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah?
+
+my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
+
+my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
 
 </%init>