X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fselect.html;h=100df94d08c76e6248eaa0fa6d9ac0e929950092;hp=5249a6dc3e43d33d7521af7d0e3f4f63a12a2106;hb=b71b1576c68bc40ad26592b354feace37a029f0e;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984 diff --git a/httemplate/elements/select.html b/httemplate/elements/select.html index 5249a6dc3..100df94d0 100644 --- a/httemplate/elements/select.html +++ b/httemplate/elements/select.html @@ -1,12 +1,43 @@ +<%doc> +<& select.html, + # required + field => 'myfield', # NAME property + curr_value => 'foo', + labels => { # or 'option_labels' + # note: these will be escaped for you, don't escape them + 'AL' => 'Alabama', + 'AK' => 'Alaska', + 'AR' => 'Arkansas', + }, + options => [ 'AL', 'AK', 'AR' ], + curr_value => scalar( $cgi->param('myfield') ), + + # recommended + id => 'myid', # DOM id + + # optional + size => 1, # to show multiple rows at once + style => '', # STYLE property + multiple => 0, + disabled => 0, + onchange => 'do_something()', + js_only => 0, # disables the whole thing + element_etc => '', # anything else to put in the + <% $size %> <% $style %> <% $opt{disabled} %> <% $onchange %> + <% $opt{'element_etc'} %> > % if ( $opt{options} ) { @@ -16,7 +47,7 @@ % } @@ -38,17 +69,13 @@ % % } - + <% $opt{'post_field_label'} %> % } <%init> my %opt = @_; -my $onchange = $opt{'onchange'} - ? 'onChange="'. $opt{'onchange'}. '(this)"' - : ''; - my $labels = $opt{'option_labels'} || $opt{'labels'}; my $curr_value = $opt{'curr_value'}; @@ -75,5 +102,8 @@ my @style = ref($opt{'style'}) my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : ''; +my $size = $opt{'size'} ? 'SIZE='.$opt{'size'} : ''; + +my $multiple = $opt{'multiple'} ? 'MULTIPLE' : '';