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

VERSION

9       version 2.07
10

SYNOPSIS

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

DESCRIPTION

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

METHODS

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

CAVEATS

270       Although this element inherits from HTML::FormFu::Element::Block, its
271       behaviour for the methods filter/filters, constraint/constraints,
272       inflator/inflators, validator/validators and transformer/transformers
273       is more like that of a field element, meaning all processors are added
274       directly to the date element, not to its select-menu child elements.
275
276       This element's get_elements and get_all_elements are inherited from
277       HTML::FormFu::Element::Block, and so have the same behaviour. However,
278       it overrides the "get_fields|HTML::FormFu/get_fields" method, such that
279       it returns both itself and its child elements.
280

SEE ALSO

282       Is a sub-class of, and inherits methods from
283       HTML::FormFu::Role::Element::Field, HTML::FormFu::Element::Multi,
284       HTML::FormFu::Element::Block, HTML::FormFu::Element
285
286       HTML::FormFu
287

AUTHOR

289       Carl Franks, "cfranks@cpan.org"
290

LICENSE

292       This library is free software, you can redistribute it and/or modify it
293       under the same terms as Perl itself.
294

AUTHOR

296       Carl Franks <cpan@fireartist.com>
297
299       This software is copyright (c) 2018 by Carl Franks.
300
301       This is free software; you can redistribute it and/or modify it under
302       the same terms as the Perl 5 programming language system itself.
303
304
305
306perl v5.32.0                      2020-07-28    HTML::FormFu::Element::Date(3)
Impressum