communigate (phase 2): rules: adding conditions and actions to rule edit. RT#7514
[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{disabled} %>
9                            <% $onchange %>
10                     ><% $opt{'postfix'} %>
11 <%init>
12
13 my %opt = @_;
14
15 my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};
16
17 my $onchange = $opt{'onchange'}
18                  ? 'onChange="'. $opt{'onchange'}. '(this)"'
19                  : '';
20
21 my $size = $opt{'size'}
22              ? 'SIZE="'. $opt{'size'}. '"'
23              : '';
24
25 my $maxlength = $opt{'maxlength'}
26                 ? 'MAXLENGTH="'. $opt{'maxlength'}. '"'
27                 : '';
28
29 $opt{'disabled'} = &{ $opt{'disabled'} }( \%opt )
30   if ref($opt{'disabled'}) eq 'CODE';
31 $opt{'disabled'} = 'DISABLED'
32   if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah?
33
34 my @style = ref($opt{'style'})
35               ? @{ $opt{'style'} }
36               : $opt{'style'}
37                 ? ( $opt{'style'} )
38                 : ();
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'} && ! $opt{'nodarken_disabled'};
45
46 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
47
48 </%init>