package HTML::FormHandler::Manual::Templates; # ABSTRACT: using templates __END__ =pod =head1 NAME HTML::FormHandler::Manual::Templates - using templates =head1 VERSION version 0.33000 =head1 SYNOPSIS Documentation on templates to use with L
    =head1 Using templates

    There are lots of different ways to set up templates. One way is to
    create a 'widget' directory, and store template snippets there.

    You can use the default 'widget' for the field class, or set the 'widget'
    for the field in your form:

       fields => [
          my_special_field => {
             type => 'Text',
             widget => 'my_special_widget',
          },
          my_second_field => {
             type => 'Text',
             widget => 'yet_another_widget',
          },
       ]

    And include them in a generic template:

       [% PROCESS widget/form_start.tt %]

       [% FOREACH f IN form.sorted_fields %]
          [% PROCESS widget/${f.widget}.tt %]
       [% END %]

       [% PROCESS widget/form_end.tt %]

    =head1 Sample templates

    Note that the following templates assume that the field is in a TT variable "f",
    as though they were processed in the above loop. Otherwise the individual
    fields could be preceded by something like:

      [% f = form.field('title') %]

    =head2 Text input field with error class on div & error messages
[% IF f.has_errors %] [% FOR error IN f.errors %]

[% error %]

[% END %] [% END %] [% f.label %]
Simple text field; [% f = form.field('text_field') %]
[% f.label %]:
=head2 Select field Single select: [% f.label %]
Multiple select: [% f.label %]
Warning: TT has problems with single element arrays. If you are likely to have a single element in a select list, you might want to use the rendering method instead or add an extra "choose" row. (If you come up with a good solution, please submit a doc patch.) =head2 Checkbox
[% f.label %]:
=head2 Textarea
[% f.label %]"
    [% f.fif %]
=head2 Hidden
=head2 Submit
=head2 Radio group
[% f.label %] [% FOR option IN f.options %] [% option.label %]
[% END %]
=head1 AUTHOR FormHandler Contributors - see HTML::FormHandler =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by Gerda Shank. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut