HTML::FormFu::Element::Date - 3 select menu multi-field
--- elements: - type: Date name: birthdate label: 'Birthdate:' day: prefix: "- Day -" month: prefix: "- Month -" year: prefix: "- Year -" less: 70 plus: 0 auto_inflate: 1
Creates a multi element containing 3 select menus for the day, month and year.
A date element named foo would result in 3 select menus with the names foo_day, foo_month and foo_year. The names can instead be overridden by the name value in "day", "month" and "year".
foo
foo_day
foo_month
foo_year
name
This element automatically merges the input parameters from the select menu into a single date parameter (and doesn't delete the individual menu's parameters).
Arguments: DateTime object
Arguments: $date_string
Accepts either a DateTime object, or a string containing a date, matching the "strftime" format. Overwrites any default value set in "day", "month" or "year".
Default Value: "%d-%m-%Y"
The format of the date as returned by "params" in HTML::FormFu, if "auto_inflate" is not set.
If "auto_inflate" is used, this is still the format that the parameter will be in prior to the DateTime inflator being run; which is what any Filters and Constraints will receive.
Arguments: \%setting
Set values effecting the day select menu. Known keys are:
day
Override the auto-generated name of the select menu.
Set the default value of the select menu
Arguments: $value
Arguments: \@values
A string or arrayref of strings to be inserted into the start of the select menu.
Each value is only used as the label for a select item - the value for each of these items is always the empty string ''.
''
Set values effecting the month select menu. Known keys are:
month
Arguments: \@months
A list of month names used for the month menu.
If not set, the list of month names is obtained from DateTime::Locale using the locale set in "languages" in HTML::FormFu.
Argument: bool
If true (and months is not set) the list of abbreviated month names is obtained from DateTime::Locale using the locale set in "languages" in HTML::FormFu.
months
Set values effecting the year select menu. Known keys are:
year
Arguments: \@years
A list of years used for the year menu.
If this is set, reference, less and plus are ignored.
reference
less
plus
Arguments: $year
Default Value: the current year, calculated from time()
If list is not set, the list is created from the range of reference - year_less to reference + year_plus.
list
reference - year_less
reference + year_plus
Arguments: $count
Default Value: 0
Default Value: 10
If true, a DateTime Inflator will automatically be added to the element, and it will be given a formatter so that stringification will result in the format specified in "strftime".
If you require the DateTime Inflator to have a different stringification format to the format used internally by your Filters and Constraints, then you must explicitly add your own DateTime Inflator, rather than using "auto_inflate".
Although this element inherits from HTML::FormFu::Element::Block, it's behaviour for the methods filter/filters, constraint/constraints, inflator/inflators, validator/validators and transformer/transformers is more like that of a field element, meaning all processors are added directly to the date element, not to it's select-menu child elements.
This element's get_elements and get_all_elements are inherited from HTML::FormFu::Element::Block, and so have the same behaviour. However, it overrides the get_fields method, such that it returns both itself and it's child elements.
get_fields
Is a sub-class of, and inherits methods from HTML::FormFu::Element::_Field, HTML::FormFu::Element::Multi, HTML::FormFu::Element::Block, HTML::FormFu::Element
HTML::FormFu::FormFu
Carl Franks, cfranks.org
cfranks.org
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
alternative text 'filter/filters' contains non-escaped | or /
alternative text 'constraint/constraints' contains non-escaped | or /
alternative text 'inflator/inflators' contains non-escaped | or /
alternative text 'validator/validators' contains non-escaped | or /
alternative text 'transformer/transformers' contains non-escaped | or /
To install HTML::FormFu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::FormFu
CPAN shell
perl -MCPAN -e shell install HTML::FormFu
For more information on module installation, please visit the detailed CPAN module installation guide.