1HTML::FormFu::Role::EleUmseenrt:C:oGnrtoruipb(u3t)ed PerHlTMDLo:c:uFmoernmtFaut:i:oRnole::Element::Group(3)
2
3
4

NAME

6       HTML::FormFu::Role::Element::Group - Role for grouped form fields
7

VERSION

9       version 2.07
10

DESCRIPTION

12       Base class for HTML::FormFu::Element::Checkboxgroup,
13       HTML::FormFu::Element::Radiogroup, and HTML::FormFu::Element::Select
14       fields.
15

METHODS

17   options
18       Arguments: none
19
20       Arguments: \@options
21
22           ---
23           elements:
24             - type: Select
25               name: foo
26               options:
27                 - [ 01, January ]
28                 - [ 02, February ]
29                 - value: 03
30                   label: March
31                   attributes:
32                     style: highlighted
33                 - [ 04, April ]
34
35       If passed no arguments, it returns an arrayref of the currently set
36       options.
37
38       Use to set the list of items in the select menu / radiogroup.
39
40       Its arguments must be an array-ref of items. Each item may be an array
41       ref of the form "[ $value, $label ]" or a hash-ref of the form "{ value
42       => $value, label => $label }". Each hash-ref may also have an
43       "attributes" key.
44
45       Passing an item containing a "group" key will, for Select fields,
46       create an optgroup. And for Radiogroup fields or Checkboxgroup fields,
47       create a sub-group of radiobuttons or checkboxes with a new "span"
48       block, with the classname "subgroup".
49
50       An example of Select optgroups:
51
52           ---
53           elements:
54             - type: Select
55               name: foo
56               options:
57                 - label: "group 1"
58                   group:
59                     - [1a, 'item 1a']
60                     - [1b, 'item 1b']
61                 - label: "group 2"
62                   group:
63                     - [2a, 'item 2a']
64                     - [2b, 'item 2b']
65
66       When using the hash-ref construct, the "label_xml" and "label_loc"
67       variants of "label" are supported, as are the "value_xml" and
68       "value_loc" variants of "value", the "attributes_xml" variant of
69       "attributes" and the "label_attributes_xml" variant of
70       "label_attributes".
71
72       "container_attributes" or "container_attributes_xml" is used by
73       HTML::FormFu::Element::Checkboxgroup and
74       HTML::FormFu::Element::Radiogroup for the c<span> surrounding each
75       item's input and label. It is ignored by HTML::FormFu::Element::Select
76       elements.
77
78       "label_attributes" / "label_attributes_xml" is used by
79       HTML::FormFu::Element::Checkboxgroup and
80       HTML::FormFu::Element::Radiogroup for the c<label> tag of each item.
81       It is ignored by HTML::FormFu::Element::Select elements.
82
83   values
84       Arguments: \@values
85
86           ---
87           elements:
88             - type: Radiogroup
89               name: foo
90               values:
91                 - jan
92                 - feb
93                 - mar
94                 - apr
95
96       A more concise alternative to "options". Use to set the list of values
97       in the select menu / radiogroup.
98
99       Its arguments must be an array-ref of values. The labels used are the
100       result of "ucfirst($value)".
101
102   value_range
103       Arguments: \@values
104
105           ---
106           elements:
107             - type: Select
108               name: foo
109               value_range:
110                 - ""
111                 - 1
112                 - 12
113
114       Similar to "values", but the last 2 values are expanded to a range. Any
115       preceding values are used literally, allowing the common empty first
116       item in select menus.
117
118   empty_first
119       If true, then a blank option will be inserted at the start of the
120       option list (regardless of whether "options", "values" or "value_range"
121       was used to populate the options).  See also "empty_first_label".
122
123   empty_first_label
124   empty_first_label_xml
125   empty_first_label_loc
126       If "empty_first" is true, and "empty_first_label" is set, this value
127       will be used as the label for the first option - so only the first
128       option's value will be empty.
129

SEE ALSO

131       Is a sub-class of, and inherits methods from
132       HTML::FormFu::Role::Element::Field, HTML::FormFu::Element
133
134       HTML::FormFu
135

AUTHOR

137       Carl Franks, "cfranks@cpan.org"
138

LICENSE

140       This library is free software, you can redistribute it and/or modify it
141       under the same terms as Perl itself.
142

AUTHOR

144       Carl Franks <cpan@fireartist.com>
145
147       This software is copyright (c) 2018 by Carl Franks.
148
149       This is free software; you can redistribute it and/or modify it under
150       the same terms as the Perl 5 programming language system itself.
151
152
153
154perl v5.28.1                      2018-12-H1T4ML::FormFu::Role::Element::Group(3)
Impressum