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