Provided by: ledgersmb_1.3.25-1_all bug

NAME

       LedgerSMB::Template::Elements - Template Utility Functions

SYNOPSIS

       Provides utility functions for generating elements for the user interface templates

METHODS

       LedgerSMB::Template::Elements->new()
           Returns a blessed hashref from this namespace.

       $object->generate_hidden_elements([...]);
           Builds  data  structure  for  hidden  form  fields.   Values  from  the  $form object are run through
           $form->quote.

           Sample data structure added to $form->hidden_elements():

            $self->{form_elements}{hidden_elements} = [{ type => 'hidden', name => 'foo', value => 'bar'... } ...]

           A reference to this structure is returned as well.

       $form->generate_radio_elements($radios);
           Roll out a single radios hash to an array of radio elements, using the values array as index.

           Sample data structure added to $form->generate_radio_elements($radios):

           my $radios = {
               name => 'radio_name',
               class => 'radio',
               attributes => { foo => 'bar' },
               values => [ '1', '2', '3'],
               labels => [ 'Label one', '', 'Label three'],
               default_value => '2', };

       $form->generate_checkbox_elements($checkboxes);
           Roll out a single checkboxes hash to an array of checkbox elements, using the names array  as  index.
           Note that if no 'values' array is passed, value for all checkboxes default to 1.

           Sample data structure added to $form->generate_checkbox_elements($checkboxes):

           my $checkboxes = {
               names => [
                   'checkbox_name1',
                   'checkbox_name2',
                   'checkbox_name3',
               ],
               class => 'checkbox',
               attributes => { foo => 'bar' },
               values => [ '4', '', '3'],
               labels => [ 'Label one', '', 'Label three'],
               default_values => [ 'checkbox_name1'],

           };

perl v5.14.2                                       2012-03-25                 LedgerSMB::Template::Elements(3pm)