RT# 73422 Fix report Customer Contacts
[freeside.git] / httemplate / elements / tr-checkbox-multiple.html
index bb90a82..baf18f9 100644 (file)
@@ -1,3 +1,23 @@
+<%doc>
+
+Display a <tr> containing multiple checkboxes
+
+USAGE:
+
+<& /elements/tr-checkbox-multipe.html,
+  label => emt('Label'),
+  field => 'field_name',
+  options => ['opt1', 'opt2'],
+  labels => {
+    opt1 => 'Option 1',
+    opt2 => 'Option 2',
+  },
+  value => {
+    opt2 => '1', # opt2 defaults as checked
+  }
+&>
+
+</%doc>
 <% include('tr-td-label.html', @_ ) %>
 
   <TD <% $style %>>
@@ -33,6 +53,8 @@ my $onchange = $opt{'onchange'}
 
 my $value = $opt{'curr_value'} || $opt{'value'};
 
+$value = $opt{default_value} if $opt{default_value} && !defined($value);
+
 my $labels = $opt{'option_labels'} || $opt{'labels'};
 
 my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';