1HTML::FormFu::Element::UDsaetre(C3o)ntributed Perl DocumHeTnMtLa:t:iFoonrmFu::Element::Date(3)
2
3
4

NAME

6       HTML::FormFu::Element::Date - 3 select menu multi-field
7

SYNOPSIS

9           ---
10           elements:
11             - type: Date
12               name: birthdate
13               label: 'Birthdate:'
14               day:
15                 prefix: "- Day -"
16               month:
17                 prefix: "- Month -"
18               year:
19                 prefix: "- Year -"
20                 less: 70
21                 plus: 0
22               auto_inflate: 1
23

DESCRIPTION

25       Creates a multi element containing 3 select menus for the day, month
26       and year.
27
28       A date element named "foo" would result in 3 select menus with the
29       names "foo_day", "foo_month" and "foo_year". The names can instead be
30       overridden by the "name" value in "day", "month" and "year".
31
32       This element automatically merges the input parameters from the select
33       menu into a single date parameter (and doesn't delete the individual
34       menu's parameters).
35

METHODS

37   default
38       Arguments: DateTime object
39
40       Arguments: $date_string
41
42       Accepts either a DateTime object, or a string containing a date,
43       matching the "strftime" format. Overwrites any default value set in
44       "day", "month" or "year".
45
46   default_natural
47       Arguments: $date_string
48
49           - type: Date
50             default_natural: 'today'
51
52       Accepts a date/time string suitable for passing to "parse_datetime" in
53       DateTime::Format::Natural.
54
55   default_datetime_args
56           - type: Date
57             default_natural: 'today'
58             default_datetime_args:
59               set_time_zone: 'Europe/London'
60
61       Accepts a hashref of method-names / values that will be called on the
62       "default" DateTime object, before the select fields' values are set
63       from it.
64
65   strftime
66       Default Value: "%d-%m-%Y"
67
68       The format of the date as returned by "params" in HTML::FormFu, if
69       "auto_inflate" is not set.
70
71       If "auto_inflate" is used, this is still the format that the parameter
72       will be in prior to the DateTime inflator being run; which is what any
73       Filters and Constraints will receive.
74
75   day
76       Arguments: \%setting
77
78       Set values effecting the "day" select menu. Known keys are:
79
80       name
81
82       Override the auto-generated name of the select menu.
83
84       default
85
86       Set the default value of the select menu
87
88       prefix
89
90       Arguments: $value
91
92       Arguments: \@values
93
94       A string or arrayref of strings to be inserted into the start of the
95       select menu.
96
97       Each value is only used as the label for a select item - the value for
98       each of these items is always the empty string ''.
99
100   month
101       Arguments: \%setting
102
103       Set values effecting the "month" select menu. Known keys are:
104
105       name
106
107       Override the auto-generated name of the select menu.
108
109       default
110
111       Set the default value of the select menu
112
113       prefix
114
115       Arguments: $value
116
117       Arguments: \@values
118
119       A string or arrayref of strings to be inserted into the start of the
120       select menu.
121
122       Each value is only used as the label for a select item - the value for
123       each of these items is always the empty string ''.
124
125       names
126
127       Arguments: \@months
128
129       A list of month names used for the month menu.
130
131       If not set, the list of month names is obtained from DateTime::Locale
132       using the locale set in "languages" in HTML::FormFu.
133
134       short_names
135
136       Argument: bool
137
138       If true (and "months" is not set) the list of abbreviated month names
139       is obtained from DateTime::Locale using the locale set in "languages"
140       in HTML::FormFu.
141
142   year
143       Arguments: \%setting
144
145       Set values effecting the "year" select menu. Known keys are:
146
147       name
148
149       Override the auto-generated name of the select menu.
150
151       default
152
153       Set the default value of the select menu
154
155       prefix
156
157       Arguments: $value
158
159       Arguments: \@values
160
161       A string or arrayref of strings to be inserted into the start of the
162       select menu.
163
164       Each value is only used as the label for a select item - the value for
165       each of these items is always the empty string ''.
166
167       list
168
169       Arguments: \@years
170
171       A list of years used for the year menu.
172
173       If this is set, "reference", "less" and "plus" are ignored.
174
175       reference
176
177       Arguments: $year
178
179       Default Value: the current year, calculated from time()
180
181       If "list" is not set, the list is created from the range of "reference
182       - year_less" to "reference + year_plus".
183
184       less
185
186       Arguments: $count
187
188       Default Value: 0
189
190       plus
191
192       Arguments: $count
193
194       Default Value: 10
195
196       reverse
197
198       Arguments: bool
199
200       Default Value: 0
201
202       If true, the list of years is listed in reverse (decreasing) order.
203
204   field_order
205       Arguments: \@fields
206
207       Default Value: ['day', 'month', 'year']
208
209       Specify the order of the date fields in the rendered HTML.
210
211       Not all 3 fields are required. No single field can be used more than
212       once.
213
214   auto_inflate
215       If true, a DateTime Inflator will automatically be added to the
216       element, and it will be given a formatter so that stringification will
217       result in the format specified in "strftime".
218
219       If you require the DateTime Inflator to have a different
220       stringification format to the format used internally by your Filters
221       and Constraints, then you must explicitly add your own DateTime
222       Inflator, rather than using "auto_inflate".
223

CAVEATS

225       Although this element inherits from HTML::FormFu::Element::Block, its
226       behaviour for the methods filter/filters, constraint/constraints,
227       inflator/inflators, validator/validators and transformer/transformers
228       is more like that of a field element, meaning all processors are added
229       directly to the date element, not to its select-menu child elements.
230
231       This element's get_elements and get_all_elements are inherited from
232       HTML::FormFu::Element::Block, and so have the same behaviour. However,
233       it overrides the "get_fields|HTML::FormFu/get_fields" method, such that
234       it returns both itself and its child elements.
235

SEE ALSO

237       Is a sub-class of, and inherits methods from
238       HTML::FormFu::Element::_Field, HTML::FormFu::Element::Multi,
239       HTML::FormFu::Element::Block, HTML::FormFu::Element
240
241       HTML::FormFu
242

AUTHOR

244       Carl Franks, "cfranks@cpan.org"
245

LICENSE

247       This library is free software, you can redistribute it and/or modify it
248       under the same terms as Perl itself.
249
250
251
252perl v5.12.1                      2010-09-02    HTML::FormFu::Element::Date(3)
Impressum