• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bin/H14-Dec-2018-18973

examples/H14-Dec-2018-1,518973

lib/HTML/H14-Dec-2018-31,70112,797

share/templates/tt/xhtml/H14-Dec-2018-120118

t/H03-May-2022-23,44717,955

xt/H14-Dec-2018-670569

ChangesH A D14-Dec-201829.3 KiB887563

LICENSEH A D14-Dec-201817.9 KiB380292

MANIFESTH A D14-Dec-201827.5 KiB856855

MANIFEST.SKIPH A D14-Dec-2018184 117

META.jsonH A D14-Dec-201844 KiB1,3461,344

META.ymlH A D14-Dec-201829.8 KiB1,0051,004

Makefile.PLH A D14-Dec-20184.6 KiB166152

READMEH A D14-Dec-201854.9 KiB2,0581,327

dist.iniH A D14-Dec-20183.2 KiB115103

README

1NAME
2
3    HTML::FormFu - HTML Form Creation, Rendering and Validation Framework
4
5VERSION
6
7    version 2.07
8
9SYNOPSIS
10
11    Note: These examples make use of HTML::FormFu::Model::DBIC. As of
12    HTML::FormFu v02.005, the HTML::FormFu::Model::DBIC module is not
13    bundled with HTML::FormFu and is available in a stand-alone
14    distribution.
15
16        use HTML::FormFu;
17
18        my $form = HTML::FormFu->new;
19
20        $form->load_config_file('form.yml');
21
22        $form->process( $cgi_query );
23
24        if ( $form->submitted_and_valid ) {
25            # do something with $form->params
26        }
27        else {
28            # display the form
29            $template->param( form => $form );
30        }
31
32    If you're using Catalyst, a more suitable example might be:
33
34        package MyApp::Controller::User;
35        use Moose;
36        extends 'Catalyst::Controller::HTML::FormFu';
37
38        sub user : Chained CaptureArgs(1) {
39            my ( $self, $c, $id ) = @_;
40
41            my $rs = $c->model('Schema')->resultset('User');
42
43            $c->stash->{user} = $rs->find( $id );
44
45            return;
46        }
47
48        sub edit : Chained('user') Args(0) FormConfig {
49            my ( $self, $c ) = @_;
50
51            my $form = $c->stash->{form};
52            my $user = $c->stash->{user};
53
54            if ( $form->submitted_and_valid ) {
55
56                $form->model->update( $user );
57
58                $c->res->redirect( $c->uri_for( "/user/$id" ) );
59                return;
60            }
61
62            $form->model->default_values( $user )
63                if ! $form->submitted;
64
65        }
66
67    Note: Because "process" is automatically called for you by the Catalyst
68    controller; if you make any modifications to the form within your
69    action method, such as adding or changing elements, adding constraints,
70    etc; you must call "process" again yourself before using
71    "submitted_and_valid", any of the methods listed under "SUBMITTED FORM
72    VALUES AND ERRORS" or "MODIFYING A SUBMITTED FORM", or rendering the
73    form.
74
75    Here's an example of a config file to create a basic login form (all
76    examples here are YAML, but you can use any format supported by
77    Config::Any), you can also create forms directly in your perl code,
78    rather than using an external config file.
79
80        ---
81        action: /login
82        indicator: submit
83        auto_fieldset: 1
84
85        elements:
86          - type: Text
87            name: user
88            constraints:
89              - Required
90
91          - type: Password
92            name: pass
93            constraints:
94              - Required
95
96          - type: Submit
97            name: submit
98
99        constraints:
100          - SingleValue
101
102DESCRIPTION
103
104    HTML::FormFu is a HTML form framework which aims to be as easy as
105    possible to use for basic web forms, but with the power and flexibility
106    to do anything else you might want to do (as long as it involves
107    forms).
108
109    You can configure almost any part of formfu's behaviour and output. By
110    default formfu renders "XHTML 1.0 Strict" compliant markup, with as
111    little extra markup as possible, but with sufficient CSS class names to
112    allow for a wide-range of output styles to be generated by changing
113    only the CSS.
114
115    All methods listed below (except "new") can either be called as a
116    normal method on your $form object, or as an option in your config
117    file. Examples will mainly be shown in YAML config syntax.
118
119    This documentation follows the convention that method arguments
120    surrounded by square brackets [] are optional, and all other arguments
121    are required.
122
123BUILDING A FORM
124
125 new
126
127    Arguments: [\%options]
128
129    Return Value: $form
130
131    Create a new HTML::FormFu object.
132
133    Any method which can be called on the HTML::FormFu object may instead
134    be passed as an argument to "new".
135
136        my $form = HTML::FormFu->new({
137            action        => '/search',
138            method        => 'GET',
139            auto_fieldset => 1,
140        });
141
142 load_config_file
143
144    Arguments: $filename
145
146    Arguments: \@filenames
147
148    Return Value: $form
149
150    Accepts a filename or list of file names, whose filetypes should be of
151    any format recognized by Config::Any.
152
153    The content of each config file is passed to "populate", and so are
154    added to the form.
155
156    "load_config_file" may be called in a config file itself, so as to
157    allow common settings to be kept in a single config file which may be
158    loaded by any form.
159
160        ---
161        load_config_file:
162          - file1
163          - file2
164
165    YAML multiple documents within a single file. The document start marker
166    is a line containing 3 dashes. Multiple documents will be applied in
167    order, just as if multiple filenames had been given.
168
169    In the following example, multiple documents are taken advantage of to
170    load another config file after the elements are added. (If this were a
171    single document, the load_config_file would be called before elements,
172    regardless of its position in the file).
173
174        ---
175        elements:
176          - name: one
177          - name: two
178
179        ---
180        load_config_file: ext.yml
181
182    Relative paths are resolved from the "config_file_path" directory if it
183    is set, otherwise from the current working directory.
184
185    See "BEST PRACTICES" for advice on organising config files.
186
187 config_callback
188
189    Arguments: \%options
190
191    If defined, the arguments are used to create a Data::Visitor::Callback
192    object during "load_config_file" which may be used to pre-process the
193    config before it is sent to "populate".
194
195    For example, the code below adds a callback to a form that will
196    dynamically alter any config value ending in ".yml" to end in ".yaml"
197    when you call "load_config_file":
198
199        $form->config_callback({
200          plain_value => sub {
201            my( $visitor, $data ) = @_;
202            s/\.yml/.yaml/;
203          }
204        });
205
206    Default Value: not defined
207
208    This method is a special 'inherited accessor', which means it can be
209    set on the form, a block element or a single element. When the value is
210    read, if no value is defined it automatically traverses the element's
211    hierarchy of parents, through any block elements and up to the form,
212    searching for a defined value.
213
214 populate
215
216    Arguments: \%options
217
218    Return Value: $form
219
220    Each option key/value passed may be any HTML::FormFu method-name and
221    arguments.
222
223    Provides a simple way to set multiple values, or add multiple elements
224    to a form with a single method-call.
225
226    Attempts to call the method-names in a semi-intelligent order (see the
227    source of populate() in HTML::FormFu::ObjectUtil for details).
228
229 default_values
230
231    Arguments: \%defaults
232
233    Return Value: $form
234
235    Set multiple field's default values from a single hash-ref.
236
237    The hash-ref's keys correspond to a form field's name, and the value is
238    passed to the field's default method.
239
240    This should be called after all fields have been added to the form, and
241    before "process" is called (otherwise, call "process" again before
242    rendering the form).
243
244 config_file_path
245
246    Arguments: $directory_name
247
248    "config_file_path" defines where configuration files will be searched
249    for, if an absolute path is not given to "load_config_file".
250
251    Default Value: not defined
252
253    This method is a special 'inherited accessor', which means it can be
254    set on the form, a block element or a single element. When the value is
255    read, if no value is defined it automatically traverses the element's
256    hierarchy of parents, through any block elements and up to the form,
257    searching for a defined value.
258
259    Is an inheriting accessor.
260
261 indicator
262
263    Arguments: $field_name
264
265    Arguments: \&coderef
266
267    If "indicator" is set to a fieldname, "submitted" will return true if a
268    value for that fieldname was submitted.
269
270    If "indicator" is set to a code-ref, it will be called as a subroutine
271    with the two arguments $form and $query, and its return value will be
272    used as the return value for "submitted".
273
274    If "indicator" is not set, "submitted" will return true if a value for
275    any known fieldname was submitted.
276
277 auto_fieldset
278
279    Arguments: 1
280
281    Arguments: \%options
282
283    Return Value: $fieldset
284
285    This setting is suitable for most basic forms, and means you can
286    generally ignore adding fieldsets yourself.
287
288    Calling $form->auto_fieldset(1) immediately adds a fieldset element to
289    the form. Thereafter, $form->elements() will add all elements (except
290    fieldsets) to that fieldset, rather than directly to the form.
291
292    To be specific, the elements are added to the last fieldset on the
293    form, so if you add another fieldset, any further elements will be
294    added to that fieldset.
295
296    Also, you may pass a hashref to auto_fieldset(), and this will be used
297    to set defaults for the first fieldset created.
298
299    A few examples and their output, to demonstrate:
300
301    2 elements with no fieldset.
302
303        ---
304        elements:
305          - type: Text
306            name: foo
307          - type: Text
308            name: bar
309
310        <form action="" method="post">
311          <div class="text">
312            <input name="foo" type="text" />
313          </div>
314          <div class="text">
315            <input name="bar" type="text" />
316          </div>
317        </form>
318
319    2 elements with an "auto_fieldset".
320
321        ---
322        auto_fieldset: 1
323        elements:
324          - type: Text
325            name: foo
326          - type: Text
327            name: bar
328
329        <form action="" method="post">
330          <fieldset>
331            <div class="text">
332              <input name="foo" type="text" />
333            </div>
334            <div class="text">
335              <input name="bar" type="text" />
336            </div>
337          </fieldset>
338        </form>
339
340    The 3rd element is within a new fieldset
341
342        ---
343        auto_fieldset: { id: fs }
344        elements:
345          - type: Text
346            name: foo
347          - type: Text
348            name: bar
349          - type: Fieldset
350          - type: Text
351            name: baz
352
353        <form action="" method="post">
354          <fieldset id="fs">
355            <div class="text">
356              <input name="foo" type="text" />
357            </div>
358            <div class="text">
359              <input name="bar" type="text" />
360            </div>
361          </fieldset>
362          <fieldset>
363            <div class="text">
364              <input name="baz" type="text" />
365            </div>
366          </fieldset>
367        </form>
368
369    Because of this behaviour, if you want nested fieldsets you will have
370    to add each nested fieldset directly to its intended parent.
371
372        my $parent = $form->get_element({ type => 'Fieldset' });
373
374        $parent->element('fieldset');
375
376 form_error_message
377
378    Arguments: $string
379
380    Normally, input errors cause an error message to be displayed alongside
381    the appropriate form field. If you'd also like a general error message
382    to be displayed at the top of the form, you can set the message with
383    "form_error_message".
384
385    To set the CSS class for the message, see "form_error_message_class".
386
387    To change the markup used to display the message, edit the
388    form_error_message template file. See "render_method".
389
390    Is an output accessor.
391
392 force_error_message
393
394    If true, forces the "form_error_message" to be displayed even if there
395    are no field errors.
396
397 default_args
398
399    Arguments: \%defaults
400
401    Set defaults which will be added to every element, constraint, etc. of
402    the given type which is subsequently added to the form.
403
404    For example, to make every Text element automatically have a size of
405    10, and make every Strftime deflator automatically get its strftime set
406    to %d/%m/%Y:
407
408        default_args:
409            elements:
410                Text:
411                    size: 10
412            deflators:
413                Strftime:
414                    strftime: '%d/%m/%Y'
415
416    An example to make all DateTime elements automatically get an
417    appropriate Strftime deflator and a DateTime inflator:
418
419        default_args:
420            elements:
421                DateTime:
422                    deflators:
423                        type: Strftime
424                        strftime: '%d-%m-%Y'
425                    inflators:
426                        type: DateTime
427                        parser:
428                            strptime: '%d-%m-%Y'
429
430  Pseudo types
431
432    As a special case, you can also use the elements keys Block, Field and
433    Input to match any element which inherits from
434    HTML::FormFu::Element::Block or which does
435    HTML::FormFu::Role::Element::Field or
436    HTML::FormFu::Role::Element::Input.
437
438  Alternatives
439
440    Each elements key can contain an any list using the | divider: e.g.
441
442        # apply the given class to any Element of type Password or Button
443        default_args:
444            elements:
445                'Password|Button':
446                    attrs:
447                        class: novalidate
448
449  Match ancestor
450
451    Each elements key list can contain a type starting with + to only match
452    elements with an ancestor of the given type: e.g.
453
454        # only apple the given class to an Input field within a Multi block
455        default_args:
456            elements:
457                'Input|+Multi':
458                    attrs:
459                        class: novalidate
460
461  Don't match ancestor
462
463    Each elements key list can contain a type starting with - to only match
464    elements who do not have an ancestor of the given type: e.g.
465
466        # apply the given class only to Input fields that are not in a Multi block
467        default_args:
468            elements:
469                'Input|-Multi':
470                    attrs:
471                        clasS: validate
472
473  Order
474
475    The arguments are applied in least- to most-specific order: Block,
476    Field, Input, $type. Within each of these, arguments are applied in
477    order of shortest-first to longest-last.
478
479    The type key must match the value returned by type, e.g. "type" in
480    HTML::FormFu::Element. If, for example, you have a custom element
481    outside of the HTML::FormFu::Element::* namespace, which you load via
482    $form->element({ type => '+My::Custom::Element' }), the key given to
483    "default_args" should not include the leading +, as that is
484    stripped-out of the returned type() value. Example:
485
486        # don't include the leading '+' here
487        default_args:
488            elements:
489                'My::Custom::Element':
490                    attrs:
491                        class: whatever
492
493        # do include the leading '+' here
494        elements:
495            - type: +My::Custom::Element
496
497  Clashes
498
499    "default_args" generates a single hashref to pass to "populate",
500    merging arguments for each type in turn - meaning "populate" is only
501    called once in total - not once for each type. Because scalar values
502    are not merged - this means later values will override earlier values:
503    e.g.
504
505        # Normally, calling $field->add_attrs({ class => 'input' })
506        # then calling      $field->add_attrs({ class => 'not-in-multi' })
507        # would result in both values being retained:
508        #           class="input not-in-multi"
509        #
510        # However, default_args() creates a single data-structure to pass once
511        # to populate(), so any scalar values will overwrite earlier ones
512        # before they reach populate().
513        #
514        # The below example would result in the longest-matching key
515        # overwriting any others:
516        #           class="not-in-multi"
517        #
518        default_args:
519            elements:
520                Input:
521                    add_attrs:
522                        class: input
523                'Input:-Multi':
524                    add_attrs:
525                        class: not-in-multi
526
527  Strictness
528
529    Note: Unlike the proper methods which have aliases, for example
530    "elements" which is an alias for "element" - the keys given to
531    default_args must be of the plural form, e.g.:
532
533        default_args:
534            elements:          {}
535            deflators:         {}
536            filters:           {}
537            constraints:       {}
538            inflators:         {}
539            validators:        {}
540            transformers:      {}
541            output_processors: {}
542
543 javascript
544
545    If set, the contents will be rendered within a script tag, inside the
546    top of the form.
547
548 javascript_src
549
550    Arguments: $url
551
552    Arguments: \@urls
553
554    Adds a script tag for each URL, immediately before any "javascript"
555    section.
556
557 stash
558
559    Arguments: [\%private_stash]
560
561    Return Value: \%stash
562
563    Provides a hash-ref in which you can store any data you might want to
564    associate with the form.
565
566        ---
567        stash:
568          foo: value
569          bar: value
570
571 elements
572
573 element
574
575    Arguments: $type
576
577    Arguments: \%options
578
579    Return Value: $element
580
581    Arguments: \@arrayref_of_types_or_options
582
583    Return Value: @elements
584
585    Adds a new element to the form. See "CORE FORM FIELDS" in
586    HTML::FormFu::Element and "OTHER CORE ELEMENTS" in
587    HTML::FormFu::Element for a list of core elements.
588
589    If you want to load an element from a namespace other than
590    HTML::FormFu::Element::, you can use a fully qualified package-name by
591    prefixing it with +.
592
593        ---
594        elements:
595          - type: +MyApp::CustomElement
596            name: foo
597
598    If a type is not provided in the \%options, the default Text will be
599    used.
600
601    "element" is an alias for "elements".
602
603 deflators
604
605 deflator
606
607    Arguments: $type
608
609    Arguments: \%options
610
611    Return Value: $deflator
612
613    Arguments: \@arrayref_of_types_or_options
614
615    Return Value: @deflators
616
617    A deflator may be associated with any form field, and allows you to
618    provide $field->default with a value which may be an object.
619
620    If an object doesn't stringify to a suitable value for display, the
621    deflator can ensure that the form field receives a suitable string
622    value instead.
623
624    See "CORE DEFLATORS" in HTML::FormFu::Deflator for a list of core
625    deflators.
626
627    If a name attribute isn't provided, a new deflator is created for and
628    added to every field on the form.
629
630    If you want to load a deflator in a namespace other than
631    HTML::FormFu::Deflator::, you can use a fully qualified package-name by
632    prefixing it with +.
633
634    "deflator" is an alias for "deflators".
635
636 insert_before
637
638    Arguments: $new_element, $existing_element
639
640    Return Value: $new_element
641
642    The 1st argument must be the element you want added, the 2nd argument
643    must be the existing element that the new element should be placed
644    before.
645
646        my $new = $form->element(\%specs);
647
648        my $position = $form->get_element({ type => $type, name => $name });
649
650        $form->insert_before( $new, $position );
651
652    In the first line of the above example, the $new element is initially
653    added to the end of the form. However, the insert_before method
654    reparents the $new element, so it will no longer be on the end of the
655    form. Because of this, if you try to copy an element from one form to
656    another, it will 'steal' the element, instead of copying it. In this
657    case, you must use clone:
658
659        my $new = $form1->get_element({ type => $type1, name => $name1 })
660                        ->clone;
661
662        my $position = $form2->get_element({ type => $type2, name => $name2 });
663
664        $form2->insert_before( $new, $position );
665
666 insert_after
667
668    Arguments: $new_element, $existing_element
669
670    Return Value: $new_element
671
672    The 1st argument must be the element you want added, the 2nd argument
673    must be the existing element that the new element should be placed
674    after.
675
676        my $new = $form->element(\%specs);
677
678        my $position = $form->get_element({ type => $type, name => $name });
679
680        $form->insert_after( $new, $position );
681
682    In the first line of the above example, the $new element is initially
683    added to the end of the form. However, the insert_after method
684    reparents the $new element, so it will no longer be on the end of the
685    form. Because of this, if you try to copy an element from one form to
686    another, it will 'steal' the element, instead of copying it. In this
687    case, you must use clone:
688
689        my $new = $form1->get_element({ type => $type1, name => $name1 })
690                        ->clone;
691
692        my $position = $form2->get_element({ type => $type2, name => $name2 });
693
694        $form2->insert_after( $new, $position );
695
696 remove_element
697
698    Arguments: $element
699
700    Return Value: $element
701
702    Removes the $element from the form or block's array of children.
703
704        $form->remove_element( $element );
705
706    The orphaned element cannot be usefully used for anything until it is
707    re-attached to a form or block with "insert_before" or "insert_after".
708
709FORM LOGIC AND VALIDATION
710
711    HTML::FormFu provides several stages for what is traditionally
712    described as validation. These are:
713
714    HTML::FormFu::Filter
715
716    HTML::FormFu::Constraint
717
718    HTML::FormFu::Inflator
719
720    HTML::FormFu::Validator
721
722    HTML::FormFu::Transformer
723
724    The first stage, the filters, allow for cleanup of user-input, such as
725    encoding, or removing leading/trailing whitespace, or removing
726    non-digit characters from a creditcard number.
727
728    All of the following stages allow for more complex processing, and each
729    of them have a mechanism to allow exceptions to be thrown, to represent
730    input errors. In each stage, all form fields must be processed without
731    error for the next stage to proceed. If there were any errors, the form
732    should be re-displayed to the user, to allow them to input correct
733    values.
734
735    Constraints are intended for low-level validation of values, such as
736    "is this an integer?", "is this value within bounds?" or "is this a
737    valid email address?".
738
739    Inflators are intended to allow a value to be turned into an
740    appropriate object. The resulting object will be passed to subsequent
741    Validators and Transformers, and will also be returned by "params" and
742    "param".
743
744    Validators are intended for higher-level validation, such as
745    business-logic and database constraints such as "is this username
746    unique?". Validators are only run if all Constraints and Inflators have
747    run without errors. It is expected that most Validators will be
748    application-specific, and so each will be implemented as a separate
749    class written by the HTML::FormFu user.
750
751 filters
752
753 filter
754
755    Arguments: $type
756
757    Arguments: \%options
758
759    Return Value: $filter
760
761    Arguments: \@arrayref_of_types_or_options
762
763    Return Value: @filters
764
765    If you provide a name or names value, the filter will be added to just
766    that named field. If you do not provide a name or names value, the
767    filter will be added to all fields already attached to the form.
768
769    See "CORE FILTERS" in HTML::FormFu::Filter for a list of core filters.
770
771    If you want to load a filter in a namespace other than
772    HTML::FormFu::Filter::, you can use a fully qualified package-name by
773    prefixing it with +.
774
775    "filter" is an alias for "filters".
776
777 constraints
778
779 constraint
780
781    Arguments: $type
782
783    Arguments: \%options
784
785    Return Value: $constraint
786
787    Arguments: \@arrayref_of_types_or_options
788
789    Return Value: @constraints
790
791    See "CORE CONSTRAINTS" in HTML::FormFu::Constraint for a list of core
792    constraints.
793
794    If a name attribute isn't provided, a new constraint is created for and
795    added to every field on the form.
796
797    If you want to load a constraint in a namespace other than
798    HTML::FormFu::Constraint::, you can use a fully qualified package-name
799    by prefixing it with +.
800
801    "constraint" is an alias for "constraints".
802
803 inflators
804
805 inflator
806
807    Arguments: $type
808
809    Arguments: \%options
810
811    Return Value: $inflator
812
813    Arguments: \@arrayref_of_types_or_options
814
815    Return Value: @inflators
816
817    See "CORE INFLATORS" in HTML::FormFu::Inflator for a list of core
818    inflators.
819
820    If a name attribute isn't provided, a new inflator is created for and
821    added to every field on the form.
822
823    If you want to load an inflator in a namespace other than
824    HTML::FormFu::Inflator::, you can use a fully qualified package-name by
825    prefixing it with +.
826
827    "inflator" is an alias for "inflators".
828
829 validators
830
831 validator
832
833    Arguments: $type
834
835    Arguments: \%options
836
837    Return Value: $validator
838
839    Arguments: \@arrayref_of_types_or_options
840
841    Return Value: @validators
842
843    See "CORE VALIDATORS" in HTML::FormFu::Validator for a list of core
844    validators.
845
846    If a name attribute isn't provided, a new validator is created for and
847    added to every field on the form.
848
849    If you want to load a validator in a namespace other than
850    HTML::FormFu::Validator::, you can use a fully qualified package-name
851    by prefixing it with +.
852
853    "validator" is an alias for "validators".
854
855 transformers
856
857 transformer
858
859    Arguments: $type
860
861    Arguments: \%options
862
863    Return Value: $transformer
864
865    Arguments: \@arrayref_of_types_or_options
866
867    Return Value: @transformers
868
869    See "CORE TRANSFORMERS" in HTML::FormFu::Transformer for a list of core
870    transformers.
871
872    If a name attribute isn't provided, a new transformer is created for
873    and added to every field on the form.
874
875    If you want to load a transformer in a namespace other than
876    HTML::FormFu::Transformer::, you can use a fully qualified package-name
877    by prefixing it with +.
878
879    "transformer" is an alias for "transformers".
880
881CHANGING DEFAULT BEHAVIOUR
882
883 render_processed_value
884
885    The default behaviour when re-displaying a form after a submission, is
886    that the field contains the original unchanged user-submitted value.
887
888    If "render_processed_value" is true, the field value will be the final
889    result after all Filters, Inflators and Transformers have been run.
890    Deflators will also be run on the value.
891
892    If you set this on a field with an Inflator, but without an equivalent
893    Deflator, you should ensure that the Inflators stringify back to a
894    usable value, so as not to confuse / annoy the user.
895
896    Default Value: false
897
898    This method is a special 'inherited accessor', which means it can be
899    set on the form, a block element or a single element. When the value is
900    read, if no value is defined it automatically traverses the element's
901    hierarchy of parents, through any block elements and up to the form,
902    searching for a defined value.
903
904    Is an inheriting accessor.
905
906 force_errors
907
908    Force a constraint to fail, regardless of user input.
909
910    If this is called at runtime, after the form has already been
911    processed, you must called "process" in HTML::FormFu again before
912    redisplaying the form to the user.
913
914    Default Value: false
915
916    This method is a special 'inherited accessor', which means it can be
917    set on the form, a block element, an element or a single constraint.
918    When the value is read, if no value is defined it automatically
919    traverses the element's hierarchy of parents, through any block
920    elements and up to the form, searching for a defined value.
921
922    Is an inheriting accessor.
923
924 params_ignore_underscore
925
926    If true, causes "params", "param" and "valid" to ignore any fields
927    whose name starts with an underscore _.
928
929    The field is still processed as normal, and errors will cause
930    "submitted_and_valid" to return false.
931
932    Default Value: false
933
934FORM ATTRIBUTES
935
936    All attributes are added to the rendered form's start tag.
937
938 attributes
939
940        # Example
941        ---
942        attributes:
943          id: form
944          class: fancy_form
945
946    Is an attribute accessor.
947
948 id
949
950    Is an attribute short-cut.
951
952 action
953
954    Default Value: ""
955
956    Get or set the action associated with the form. The default is no
957    action, which causes most browsers to submit to the current URI.
958
959    Is an attribute short-cut.
960
961 enctype
962
963    Get or set the encoding type of the form. Valid values are
964    application/x-www-form-urlencoded and multipart/form-data.
965
966    If the form contains a File element, the enctype is automatically set
967    to multipart/form-data.
968
969    Is an attribute short-cut.
970
971 method
972
973    Default Value: "post"
974
975    Get or set the method used to submit the form. Can be set to either
976    "post" or "get".
977
978    Is an attribute short-cut.
979
980 title
981
982    Get or set the form's title attribute.
983
984    Is an attribute short-cut.
985
986CSS CLASSES
987
988 form_error_message_class
989
990    Class attribute for the error message displayed at the top of the form.
991
992    See "form_error_message"
993
994LOCALIZATION
995
996 languages
997
998    Arguments: [\@languages]
999
1000    A list of languages which will be passed to the localization object.
1001
1002    Default Value: ['en']
1003
1004 localize_class
1005
1006    Arguments: [$class_name]
1007
1008    Classname to be used for the default localization object.
1009
1010    Default Value: 'HTML::FormFu::I18N'
1011
1012 localize
1013
1014 loc
1015
1016    Arguments: [$key, @arguments]
1017
1018    Compatible with the maketext method in Locale::Maketext.
1019
1020 locale
1021
1022    Arguments: $locale
1023
1024    Currently only used by HTML::FormFu::Deflator::FormatNumber and
1025    HTML::FormFu::Filter::FormatNumber.
1026
1027    This method is a special 'inherited accessor', which means it can be
1028    set on the form, a block element or a single element. When the value is
1029    read, if no value is defined it automatically traverses the element's
1030    hierarchy of parents, through any block elements and up to the form,
1031    searching for a defined value.
1032
1033    Is an inheriting accessor.
1034
1035PROCESSING A FORM
1036
1037 query
1038
1039    Arguments: [$query_object]
1040
1041    Arguments: \%params
1042
1043    Provide a CGI compatible query object or a hash-ref of submitted
1044    names/values. Alternatively, the query object can be passed directly to
1045    the "process" object.
1046
1047 query_type
1048
1049    Arguments: [$query_type]
1050
1051    Set which module is being used to provide the "query".
1052
1053    The Catalyst::Controller::HTML::FormFu automatically sets this to
1054    Catalyst.
1055
1056    Valid values are CGI, Catalyst and CGI::Simple.
1057
1058    Default Value: 'CGI'
1059
1060 process
1061
1062    Arguments: [$query_object]
1063
1064    Arguments: [\%params]
1065
1066    Process the provided query object or input values. process must be
1067    called before calling any of the methods listed under "SUBMITTED FORM
1068    VALUES AND ERRORS" and "MODIFYING A SUBMITTED FORM".
1069
1070    process must also be called at least once before printing the form or
1071    calling "render" or "render_data".
1072
1073    Note to users of Catalyst::Controller::HTML::FormFu: Because "process"
1074    is automatically called for you by the Catalyst controller; if you make
1075    any modifications to the form within your action method, such as adding
1076    or changing elements, adding constraints, etc; you must call "process"
1077    again yourself before using "submitted_and_valid", any of the methods
1078    listed under "SUBMITTED FORM VALUES AND ERRORS" or "MODIFYING A
1079    SUBMITTED FORM", or rendering the form.
1080
1081SUBMITTED FORM VALUES AND ERRORS
1082
1083 submitted
1084
1085    Returns true if the form has been submitted. See "indicator" for
1086    details on how this is computed.
1087
1088 submitted_and_valid
1089
1090    Shorthand for $form->submitted && !$form->has_errors
1091
1092 params
1093
1094    Return Value: \%params
1095
1096    Returns a hash-ref of all valid input for which there were no errors.
1097
1098 param_value
1099
1100    Arguments: $field_name
1101
1102    A more reliable, recommended version of "param". Guaranteed to always
1103    return a single value, regardless of whether it's called in list
1104    context or not. If multiple values were submitted, this only returns
1105    the first value. If the value is invalid or the form was not submitted,
1106    it returns undef. This makes it suitable for use in list context, where
1107    a single value is required.
1108
1109        $db->update({
1110            name    => $form->param_value('name'),
1111            address => $form->param_value('address),
1112        });
1113
1114 param_array
1115
1116    Arguments: $field_name
1117
1118    Guaranteed to always return an array-ref of values, regardless of
1119    context and regardless of whether multiple values were submitted or
1120    not. If the value is invalid or the form was not submitted, it returns
1121    an empty array-ref.
1122
1123 param_list
1124
1125    Arguments: $field_name
1126
1127    Guaranteed to always return a list of values, regardless of context. If
1128    the value is invalid or the form was not submitted, it returns an empty
1129    list.
1130
1131 param
1132
1133    Arguments: [$field_name]
1134
1135    Return Value: $input_value
1136
1137    Return Value: @valid_names
1138
1139    No longer recommended for use, as its behaviour is hard to predict. Use
1140    "param_value", "param_array" or "param_list" instead.
1141
1142    A (readonly) method similar to that of CGI's.
1143
1144    If a field name is given, in list-context returns any valid values
1145    submitted for that field, and in scalar-context returns only the first
1146    of any valid values submitted for that field.
1147
1148    If no argument is given, returns a list of all valid input field names
1149    without errors.
1150
1151    Passing more than 1 argument is a fatal error.
1152
1153 valid
1154
1155    Arguments: [$field_name]
1156
1157    Return Value: @valid_names
1158
1159    Return Value: $bool
1160
1161    If a field name if given, returns true if that field had no errors and
1162    false if there were errors.
1163
1164    If no argument is given, returns a list of all valid input field names
1165    without errors.
1166
1167 has_errors
1168
1169    Arguments: [$field_name]
1170
1171    Return Value: @names
1172
1173    Return Value: $bool
1174
1175    If a field name if given, returns true if that field had errors and
1176    false if there were no errors.
1177
1178    If no argument is given, returns a list of all input field names with
1179    errors.
1180
1181 get_errors
1182
1183    Arguments: [%options]
1184
1185    Arguments: [\%options]
1186
1187    Return Value: \@errors
1188
1189    Returns an array-ref of exception objects from all fields in the form.
1190
1191    Accepts both name, type and stage arguments to narrow the returned
1192    results.
1193
1194        $form->get_errors({
1195            name  => 'foo',
1196            type  => 'Regex',
1197            stage => 'constraint'
1198        });
1199
1200 get_error
1201
1202    Arguments: [%options]
1203
1204    Arguments: [\%options]
1205
1206    Return Value: $error
1207
1208    Accepts the same arguments as "get_errors", but only returns the first
1209    error found.
1210
1211MODEL / DATABASE INTERACTION
1212
1213    See HTML::FormFu::Model for further details and available models.
1214
1215 default_model
1216
1217    Arguments: $model_name
1218
1219    Default Value: 'DBIC'
1220
1221 model
1222
1223    Arguments: [$model_name]
1224
1225    Return Value: $model
1226
1227 model_config
1228
1229    Arguments: \%config
1230
1231MODIFYING A SUBMITTED FORM
1232
1233 add_valid
1234
1235    Arguments: $name, $value
1236
1237    Return Value: $value
1238
1239    The provided value replaces any current value for the named field. This
1240    value will be returned in subsequent calls to "params" and "param" and
1241    the named field will be included in calculations for "valid".
1242
1243 clear_errors
1244
1245    Deletes all errors from a submitted form.
1246
1247RENDERING A FORM
1248
1249 render
1250
1251    Return Value: $string
1252
1253    You must call "process" once after building the form, and before
1254    calling "render".
1255
1256 start
1257
1258    Return Value: $string
1259
1260    Returns the form start tag, and any output of "form_error_message" and
1261    "javascript".
1262
1263 end
1264
1265    Return Value: $string
1266
1267    Returns the form end tag.
1268
1269 hidden_fields
1270
1271    Return Value: $string
1272
1273    Returns all hidden form fields.
1274
1275PLUGIN SYSTEM
1276
1277    HTML::FormFu provides a plugin-system that allows plugins to be easily
1278    added to a form or element, to change the default behaviour or output.
1279
1280    See HTML::FormFu::Plugin for details.
1281
1282ADVANCED CUSTOMISATION
1283
1284    By default, formfu renders "XHTML 1.0 Strict" compliant markup, with as
1285    little extra markup as possible. Many hooks are provided to add
1286    programatically-generated CSS class names, to allow for a wide-range of
1287    output styles to be generated by changing only the CSS.
1288
1289    Basic customisation of the markup is possible via the layout and
1290    multi_layout methods. This allows you to reorder the position of
1291    various parts of each field - such as the label, comment, error
1292    messages and the input tag - as well as inserting any other arbitrary
1293    tags you may wish.
1294
1295    If this is not sufficient, you can make completely personalise the
1296    markup by telling HTML::FormFu to use an external rendering engine,
1297    such as Template Toolkit or Template::Alloy. See "render_method" and
1298    "tt_module" for details.
1299
1300    Even if you set HTML::FormFu to use Template::Toolkit to render, the
1301    forms, HTML::FormFu can still be used in conjunction with whichever
1302    other templating system you prefer to use for your own page layouts,
1303    whether it's HTML::Template: <TMPL_VAR form>, Petal: <form
1304    tal:replace="form"></form> or Template::Magic: <!-- {form} -->.
1305
1306    As of HTML::FormFu v1.00, TT is no longer listed a required
1307    prerequisite - so you'll need to install it manually if you with to use
1308    the template files.
1309
1310 render_method
1311
1312    Default Value: string
1313
1314    Can be set to tt to generate the form with external template files.
1315
1316    To customise the markup, you'll need a copy of the template files,
1317    local to your application. See "Installing the TT templates" in
1318    HTML::FormFu::Manual::Cookbook for further details.
1319
1320    You can customise the markup for a single element by setting that
1321    element's "render_method" to tt, while the rest of the form uses the
1322    default string render-method. Note though, that if you try setting the
1323    form or a Block's "render_method" to tt, and then set a child element's
1324    "render_method" to string, that setting will be ignored, and the child
1325    elements will still use the tt render-method.
1326
1327        ---
1328        elements:
1329          - name: foo
1330            render_method: tt
1331            filename: custom_field
1332
1333          - name: bar
1334
1335        # in this example, 'foo' will use a custom template,
1336        # while bar will use the default 'string' rendering method
1337
1338    This method is a special 'inherited accessor', which means it can be
1339    set on the form, a block element or a single element. When the value is
1340    read, if no value is defined it automatically traverses the element's
1341    hierarchy of parents, through any block elements and up to the form,
1342    searching for a defined value.
1343
1344    Is an inheriting accessor.
1345
1346 filename
1347
1348    Change the template filename used for the form.
1349
1350    Default Value: "form"
1351
1352 tt_args
1353
1354    Arguments: [\%constructor_arguments]
1355
1356    Accepts a hash-ref of arguments passed to "render_method", which is
1357    called internally by "render".
1358
1359    Within tt_args, the keys RELATIVE and RECURSION are overridden to
1360    always be true, as these are a basic requirement for the Template
1361    engine.
1362
1363    The system directory containing HTML::FormFu's template files is always
1364    added to the end of INCLUDE_PATH, so that the core template files will
1365    be found. You only need to set this yourself if you have your own copy
1366    of the template files for customisation purposes.
1367
1368    This method is a special 'inherited accessor', which means it can be
1369    set on the form, a block element or a single element. When the value is
1370    read, if no value is defined it automatically traverses the element's
1371    hierarchy of parents, through any block elements and up to the form,
1372    searching for a defined value.
1373
1374 add_tt_args
1375
1376    Arguments: [\%constructor_arguments]
1377
1378    Ensures that the hash-ref argument is merged with any existing hash-ref
1379    value of "tt_args".
1380
1381 tt_module
1382
1383    Default Value: Template
1384
1385    The module used when "render_method" is set to tt. Should provide an
1386    interface compatible with Template.
1387
1388    This method is a special 'inherited accessor', which means it can be
1389    set on the form, a block element or a single element. When the value is
1390    read, if no value is defined it automatically traverses the element's
1391    hierarchy of parents, through any block elements and up to the form,
1392    searching for a defined value.
1393
1394 render_data
1395
1396    Usually called implicitly by "render". Returns the data structure that
1397    would normally be passed onto the string or tt render-methods.
1398
1399    As with "render", you must call "process" once after building the form,
1400    and before calling "render_data".
1401
1402 render_data_non_recursive
1403
1404    Like "render_data", but doesn't include the data for any
1405    child-elements.
1406
1407INTROSPECTION
1408
1409 get_fields
1410
1411    Arguments: [%options]
1412
1413    Arguments: [\%options]
1414
1415    Return Value: \@elements
1416
1417    Returns all fields in the form (specifically, all elements which have a
1418    true "is_field" in HTML::FormFu::Element value).
1419
1420    Accepts both name and type arguments to narrow the returned results.
1421
1422        $form->get_fields({
1423            name => 'foo',
1424            type => 'Radio',
1425        });
1426
1427    Accepts also an Regexp to search for results.
1428
1429        $form->get_elements({
1430            name => qr/oo/,
1431        });
1432
1433 get_field
1434
1435    Arguments: [%options]
1436
1437    Arguments: [\%options]
1438
1439    Return Value: $element
1440
1441    Accepts the same arguments as "get_fields", but only returns the first
1442    field found.
1443
1444 get_elements
1445
1446    Arguments: [%options]
1447
1448    Arguments: [\%options]
1449
1450    Return Value: \@elements
1451
1452    Returns all top-level elements in the form (not recursive). See
1453    "get_all_elements" for a recursive version.
1454
1455    Accepts both name and type arguments to narrow the returned results.
1456
1457        $form->get_elements({
1458            name => 'foo',
1459            type => 'Radio',
1460        });
1461
1462    Accepts also an Regexp to search for results.
1463
1464        $form->get_elements({
1465            name => qr/oo/,
1466        });
1467
1468 get_element
1469
1470    Arguments: [%options]
1471
1472    Arguments: [\%options]
1473
1474    Return Value: $element
1475
1476    Accepts the same arguments as "get_elements", but only returns the
1477    first element found.
1478
1479    See "get_all_element" for a recursive version.
1480
1481 get_all_elements
1482
1483    Arguments: [%options]
1484
1485    Arguments: [\%options]
1486
1487    Return Value: \@elements
1488
1489    Returns all elements in the form recursively.
1490
1491    Optionally accepts both name and type arguments to narrow the returned
1492    results.
1493
1494        # return all Text elements
1495
1496        $form->get_all_elements({
1497            type => 'Text',
1498        });
1499
1500    Accepts also an Regexp to search for results.
1501
1502        $form->get_elements({
1503            name => qr/oo/,
1504        });
1505
1506    See "get_elements" for a non-recursive version.
1507
1508 get_all_element
1509
1510    Arguments: [%options]
1511
1512    Arguments: [\%options]
1513
1514    Return Value: $element
1515
1516    Accepts the same arguments as "get_all_elements", but only returns the
1517    first element found.
1518
1519        # return the first Text field found, regardless of whether it's
1520        # within a fieldset or not
1521
1522        $form->get_all_element({
1523            type => 'Text',
1524        });
1525
1526    Accepts also an Regexp to search for results.
1527
1528        $form->get_elements({
1529            name => qr/oo/,
1530        });
1531
1532    See "get_all_elements" for a non-recursive version.
1533
1534 get_deflators
1535
1536    Arguments: [%options]
1537
1538    Arguments: [\%options]
1539
1540    Return Value: \@deflators
1541
1542    Returns all top-level deflators from all fields.
1543
1544    Accepts both name and type arguments to narrow the returned results.
1545
1546        $form->get_deflators({
1547            name => 'foo',
1548            type => 'Strftime',
1549        });
1550
1551 get_deflator
1552
1553    Arguments: [%options]
1554
1555    Arguments: [\%options]
1556
1557    Return Value: $element
1558
1559    Accepts the same arguments as "get_deflators", but only returns the
1560    first deflator found.
1561
1562 get_filters
1563
1564    Arguments: [%options]
1565
1566    Arguments: [\%options]
1567
1568    Return Value: \@filters
1569
1570    Returns all top-level filters from all fields.
1571
1572    Accepts both name and type arguments to narrow the returned results.
1573
1574        $form->get_filters({
1575            name => 'foo',
1576            type => 'LowerCase',
1577        });
1578
1579 get_filter
1580
1581    Arguments: [%options]
1582
1583    Arguments: [\%options]
1584
1585    Return Value: $filter
1586
1587    Accepts the same arguments as "get_filters", but only returns the first
1588    filter found.
1589
1590 get_constraints
1591
1592    Arguments: [%options]
1593
1594    Arguments: [\%options]
1595
1596    Return Value: \@constraints
1597
1598    Returns all constraints from all fields.
1599
1600    Accepts both name and type arguments to narrow the returned results.
1601
1602        $form->get_constraints({
1603            name => 'foo',
1604            type => 'Equal',
1605        });
1606
1607 get_constraint
1608
1609    Arguments: [%options]
1610
1611    Arguments: [\%options]
1612
1613    Return Value: $constraint
1614
1615    Accepts the same arguments as "get_constraints", but only returns the
1616    first constraint found.
1617
1618 get_inflators
1619
1620    Arguments: [%options]
1621
1622    Arguments: [\%options]
1623
1624    Return Value: \@inflators
1625
1626    Returns all inflators from all fields.
1627
1628    Accepts both name and type arguments to narrow the returned results.
1629
1630        $form->get_inflators({
1631            name => 'foo',
1632            type => 'DateTime',
1633        });
1634
1635 get_inflator
1636
1637    Arguments: [%options]
1638
1639    Arguments: [\%options]
1640
1641    Return Value: $inflator
1642
1643    Accepts the same arguments as "get_inflators", but only returns the
1644    first inflator found.
1645
1646 get_validators
1647
1648    Arguments: [%options]
1649
1650    Arguments: [\%options]
1651
1652    Return Value: \@validators
1653
1654    Returns all validators from all fields.
1655
1656    Accepts both name and type arguments to narrow the returned results.
1657
1658        $form->get_validators({
1659            name => 'foo',
1660            type => 'Callback',
1661        });
1662
1663 get_validator
1664
1665    Arguments: [%options]
1666
1667    Arguments: [\%options]
1668
1669    Return Value: $validator
1670
1671    Accepts the same arguments as "get_validators", but only returns the
1672    first validator found.
1673
1674 get_transformers
1675
1676    Arguments: [%options]
1677
1678    Arguments: [\%options]
1679
1680    Return Value: \@transformers
1681
1682    Returns all transformers from all fields.
1683
1684    Accepts both name and type arguments to narrow the returned results.
1685
1686        $form->get_transformers({
1687            name => 'foo',
1688            type => 'Callback',
1689        });
1690
1691 get_transformer
1692
1693    Arguments: [%options]
1694
1695    Arguments: [\%options]
1696
1697    Return Value: $transformer
1698
1699    Accepts the same arguments as "get_transformers", but only returns the
1700    first transformer found.
1701
1702 clone
1703
1704    Returns a deep clone of the <$form> object.
1705
1706    Because of scoping issues, code references (such as in Callback
1707    constraints) are copied instead of cloned.
1708
1709ATTRIBUTE ACCESSORS
1710
1711    For the basic method, e.g. /attributes:
1712
1713    Arguments: [%attributes]
1714
1715    Arguments: [\%attributes]
1716
1717    Return Value: $form
1718
1719    As a special case, if no arguments are passed, the attributes hash-ref
1720    is returned. This allows the following idioms.
1721
1722        # set a value
1723        $form->attributes->{id} = 'form';
1724
1725        # delete all attributes
1726        %{ $form->attributes } = ();
1727
1728    All methods documented as 'attribute accessors' also have the following
1729    variants generated:
1730
1731    *_xml can be used as a setter, and ensures that its argument is not
1732    XML-escaped in the rendered form.
1733
1734    *_loc can he used as a setter, and passes the arguments through
1735    "localize".
1736
1737    add_* can be used to append a word to an attribute without overwriting
1738    any already-existing value.
1739
1740        # Example
1741        $form->attributes({ class => 'fancy' });
1742        $form->add_attributes({ class => 'pants' });
1743        # class="fancy pants"
1744
1745    add_*_xml, like add_*, but ensures it doesn't get XML-escaped.
1746
1747    add_*_loc, like add_*, but passing the arguments through "localize".
1748
1749    del_* can be used to remove a word from an attribute value.
1750
1751        # Example
1752        $form->attributes({ class => 'fancy pants' });
1753        $form->del_attributes({ class => 'pants' });
1754        # class="fancy"
1755
1756    del_*_xml, like del_*, but ensures it doesn't get XML-escaped.
1757
1758    del_*_loc, like del_*, but passing the arguments through "localize".
1759
1760    Also, any attribute method-name which contains the word attributes also
1761    has aliases created for all these variants, with the word attributes
1762    replaced by attrs.
1763
1764        # For example, the attributes() method would have all these variant
1765        # methods available
1766
1767        $form->attributes({ class => 'fancy' });
1768        $form->attributes_xml({ title => '<b>fancy</b>' });
1769        $form->attributes_loc({ title => 'fancy' });
1770        $form->add_attributes({ class => 'fancy' });
1771        $form->add_attributes_xml({ title => '<b>fancy</b>' });
1772        $form->add_attributes_loc({ title => 'fancy' });
1773        $form->del_attributes({ class => 'fancy' });
1774        $form->del_attributes_xml({ title => '<b>fancy</b>' });
1775        $form->del_attributes_loc({ title => 'fancy' });
1776
1777        # Because the method contains the word 'attributes', it also gets the
1778        # following short-forms
1779
1780        $form->attrs({ class => 'fancy' });
1781        $form->attrs_xml({ title => '<b>fancy</b>' });
1782        $form->attrs_loc({ title => 'fancy' });
1783        $form->add_attrs({ class => 'fancy' });
1784        $form->add_attrs_xml({ title => '<b>fancy</b>' });
1785        $form->add_attrs_loc({ title => 'fancy' });
1786        $form->del_attrs({ class => 'fancy' });
1787        $form->del_attrs_xml({ title => '<b>fancy</b>' });
1788        $form->del_attrs_loc({ title => 'fancy' });
1789
1790ATTRIBUTE SHORT-CUTS
1791
1792    All methods documented as 'attribute short-cuts' are short-cuts to
1793    directly access individual attribute key/values.
1794
1795        # Example
1796        $form->id( 'login' );
1797        $id = $form->id;
1798
1799        # is equivalent to:
1800        $form->attributes({ id => 'login' });
1801        $id = $form->attributes->{id};
1802
1803    All attribute short-cuts also have a *_xml variant.
1804
1805        # Example
1806        $form->id_xml( $xml );
1807
1808        # is equivalent to:
1809        $form->attributes_xml({ id => $xml });
1810
1811    All attribute short-cuts also have a *_loc variant.
1812
1813        # Example
1814        $form->title_loc( $key );
1815
1816        # is equivalent to:
1817        $form->attributes_loc({ title => $key });
1818
1819INHERITING ACCESSORS
1820
1821    All methods documented as 'inheriting accessors' can be set on the
1822    form, a block element or a single field element. When the value is
1823    read, if no value is defined it automatically traverses the element's
1824    hierarchy of parents, searching for a defined value.
1825
1826    All inherited accessors also have a *_no_inherit variant, which can be
1827    used as a getter to fetch any defined value, without traversing the
1828    hierarchy of parents. This variant cannot be used as a setter.
1829
1830    E.g., the "auto_id" has a variant named auto_id_no_inherit.
1831
1832OUTPUT ACCESSORS
1833
1834    All methods documented as 'output accessors' also have *_xml and *_loc
1835    variants.
1836
1837    The *_xml variant can be used as a setter, and ensures that its
1838    argument is not XML-escaped in the rendered form.
1839
1840    The *_loc variant can be used as a setter, and passes the arguments
1841    through "localize".
1842
1843    E.g., the label method has variants named label_xml and label_loc.
1844
1845BOOLEAN ATTRIBUTE ACCESSORS
1846
1847    To support boolean attributes, whose value should either be equal to
1848    the attribute name, or empty. Any true value will switch the attribute
1849    'on', any false value will remove the attribute.
1850
1851        # Example
1852
1853        $field->autofocus(1);
1854        # equivalent to:
1855        $field->attributes({ autofocus => 'autofocus' });
1856
1857        $field->autofocus(0);;
1858        # equivalent to:
1859        delete $field->attributes->{autofocus};
1860
1861ATTRIBUTE SUBSTITUTIONS
1862
1863    Some attributes support character substitutions: the following
1864    substitutions are possible:
1865
1866        %f # $form->id
1867        %n # $field->name
1868        %t # lc( $field->type )
1869        %r # $block->repeatable_count
1870        %s # $error->stage
1871
1872    These allow each field to have consistent attributes, while remaining
1873    unique.
1874
1875DEPRECATION POLICY
1876
1877    We try our best to not make incompatible changes, but if they're
1878    required we'll make every effort possible to provide backwards
1879    compatibility for several release-cycles, issuing a warnings about the
1880    changes, before removing the legacy features.
1881
1882RESTORING LEGACY HTML CLASSES
1883
1884    v1.00 dropped most of the default HTML class-names, with the intention
1885    that each application should define just what it needs, without needing
1886    to reset unwanted options first. We also gain the benefit of less
1887    markup being generated, speeding up both render and HTTP transfers.
1888
1889    To restore the previous behaviour, set the following options.
1890
1891    If you're using best practices, you'll only need to set these once
1892    per-application in your app-wide config file.
1893
1894        ---
1895        auto_container_class: '%t'
1896        auto_container_label_class: 'label'
1897        auto_container_comment_class: 'comment'
1898        auto_comment_class: 'comment'
1899        auto_container_error_class: 'error'
1900        auto_container_per_error_class: 'error_%s_%t'
1901        auto_error_class: 'error_message error_%s_%t'
1902
1903DEPRECATED METHODS
1904
1905    See "DEPRECATED METHODS" in HTML::FormFu::Role::Element::Field.
1906
1907REMOVED METHODS
1908
1909    See also "REMOVED METHODS" in HTML::FormFu::Element.
1910
1911 element_defaults
1912
1913    Has been removed; see "default_args" instead.
1914
1915 model_class
1916
1917    Has been removed; use "default_model" instead.
1918
1919 defaults_from_model
1920
1921    Has been removed; use "default_values" in HTML::FormFu::Model instead.
1922
1923 save_to_model
1924
1925    Has been removed; use "update" in HTML::FormFu::Model instead.
1926
1927BEST PRACTICES
1928
1929    It is advisable to keep application-wide (or global) settings in a
1930    single config file, which should be loaded by each form.
1931
1932    See "load_config_file".
1933
1934COOKBOOK
1935
1936    HTML::FormFu::Manual::Cookbook
1937
1938 UNICODE
1939
1940    HTML::FormFu::Manual::Unicode
1941
1942EXAMPLES
1943
1944 vertically-aligned CSS
1945
1946    The distribution directory examples/vertically-aligned contains a form
1947    with example CSS for a "vertically aligned" theme.
1948
1949    This can be viewed by opening the file vertically-aligned.html in a
1950    web-browser.
1951
1952    If you wish to experiment with making changes, the form is defined in
1953    file vertically-aligned.yml, and the HTML file can be updated with any
1954    changes by running the following command (while in the distribution
1955    root directory).
1956
1957        perl examples/vertically-aligned/vertically-aligned.pl
1958
1959    This uses the Template Toolkit file vertically-aligned.tt, and the CSS
1960    is defined in files vertically-aligned.css and
1961    vertically-aligned-ie.css.
1962
1963SUPPORT
1964
1965    Project Page:
1966
1967    http://code.google.com/p/html-formfu/
1968
1969    Mailing list:
1970
1971    http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
1972
1973    Mailing list archives:
1974
1975    http://lists.scsys.co.uk/pipermail/html-formfu/
1976
1977    IRC:
1978
1979    irc.perl.org, channel #formfu
1980
1981    The HTML::Widget archives
1982    http://lists.scsys.co.uk/pipermail/html-widget/ between January and May
1983    2007 also contain discussion regarding HTML::FormFu.
1984
1985BUGS
1986
1987    Please submit bugs / feature requests to
1988    https://github.com/FormFu/HTML-FormFu/issues (preferred) or
1989    http://rt.perl.org.
1990
1991PATCHES
1992
1993    To help patches be applied quickly, please send them to the mailing
1994    list; attached, rather than inline; against subversion, rather than a
1995    cpan version (run svn diff > patchfile); mention which svn version it's
1996    against. Mailing list messages are limited to 256KB, so gzip the patch
1997    if necessary.
1998
1999GITHUB REPOSITORY
2000
2001    This module's sourcecode is maintained in a git repository at
2002    git://github.com/FormFu/HTML-FormFu.git
2003
2004    The project page is https://github.com/FormFu/HTML-FormFu
2005
2006SEE ALSO
2007
2008    HTML::FormFu::Imager
2009
2010    Catalyst::Controller::HTML::FormFu
2011
2012    HTML::FormFu::Model::DBIC
2013
2014CONTRIBUTORS
2015
2016    Brian Cassidy
2017
2018    Ozum Eldogan
2019
2020    Ruben Fonseca
2021
2022    Ronald Kimball
2023
2024    Daisuke Maki
2025
2026    Andreas Marienborg
2027
2028    Mario Minati
2029
2030    Steve Nolte
2031
2032    Moritz Onken
2033
2034    Doug Orleans
2035
2036    Matthias Dietrich
2037
2038    Dean Hamstead
2039
2040    Karen Etheridge
2041
2042    Nigel Metheringham
2043
2044    Based on the original source code of HTML::Widget, by Sebastian Riedel,
2045    sri@oook.de.
2046
2047AUTHOR
2048
2049    Carl Franks <cpan@fireartist.com>
2050
2051COPYRIGHT AND LICENSE
2052
2053    This software is copyright (c) 2018 by Carl Franks.
2054
2055    This is free software; you can redistribute it and/or modify it under
2056    the same terms as the Perl 5 programming language system itself.
2057
2058