Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / elements / select.html
index efcf27b..42cd895 100644 (file)
@@ -1,9 +1,37 @@
+<%doc>
+<& select.html,
+  # required
+    field       => 'myfield', # NAME property
+    curr_value  => 'foo',
+    labels      => { # or 'option_labels'
+                     'AL' => 'Alabama',
+                     'AK' => 'Alaska',
+                     'AR' => 'Arkansas',
+                   },
+    options     => [ 'AL', 'AK', 'AR' ],
+    curr_value  => $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
+&>
+</%doc>
+    
 % unless ( $opt{'js_only'} ) {
 
 <SELECT NAME          = "<% $opt{field} %>"
         ID            = "<% $opt{id} %>"
         previousValue = "<% $curr_value %>"
         previousText  = "<% $labels->{$curr_value} || $curr_value %>"
+        <% $multiple %>
+        <% $size %>
         <% $style %>
         <% $opt{disabled} %>
         <% $onchange %>
@@ -71,5 +99,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' : '';
 
 </%init>