1HTML::FormFu::Element(3U)ser Contributed Perl DocumentatiHoTnML::FormFu::Element(3)
2
3
4
6 HTML::FormFu::Element - Element Base Class
7
9 version 2.07
10
12 ---
13 elements:
14 - type: Text
15 name: username
16 constraints:
17 - type: Required
18
19 - type: Password
20 name: password
21 constraints:
22 - type: Required
23 - type: Equal
24 others: repeat-password
25
26 - type: Password
27 name: repeat-password
28
29 - type: Submit
30
32 Elements are the basic building block of all forms. Elements may be
33 logical form-fields, blocks such as "div"s and "fieldset"s, non-blocks
34 such as "hr"s and other special elements such as tables.
35
36 For simple, automatic handling of fieldsets see the "auto_fieldset" in
37 HTML::FormFu setting.
38
39 See "deflators" in HTML::FormFu for details of Deflators.
40
41 See "FORM LOGIC AND VALIDATION" in HTML::FormFu for details of Filters,
42 Constraints, Inflators, Validators and Transformers.
43
45 name
46 For field element, this value is used as the "name" attribute which the
47 field's value is associated with.
48
49 For all elements, the "name" value can be useful for identifying and
50 retrieving specific elements.
51
52 is_field
53 Return Value: boolean
54
55 Returns "true" or "false" depending on whether the element is a logical
56 form-field.
57
58 This is used by "get_fields" in HTML::FormFu.
59
61 load_config_file
62 Arguments: $filename
63
64 Arguments: \@filenames
65
66 Populate an element using a config file:
67
68 ---
69 elements:
70 - type: Block
71 load_config_file: 'elements.yml'
72
73 See "load_config_file" in HTML::FormFu for further details.
74
75 load_config_filestem
76 Arguments: $filestem
77
78 Arguments: \@filestems
79
80 Like "load_config_file", but you shouldn't include the file extension
81 in the passed string. This allows you to change your config-file type,
82 without having to change the code that loads the files.
83
84 config_file_path
85 Arguments: $directory_name
86
87 "config_file_path" defines where configuration files will be searched
88 for, if an absolute path is not given to "load_config_file".
89
90 Default Value: not defined
91
92 This method is a special 'inherited accessor', which means it can be
93 set on the form, a block element or a single element. When the value is
94 read, if no value is defined it automatically traverses the element's
95 hierarchy of parents, through any block elements and up to the form,
96 searching for a defined value.
97
98 config_callback
99 See "config_callback" in HTML::FormFu for details.
100
101 populate
102 See "populate" in HTML::FormFu for details.
103
104 stash
105 See "stash" in HTML::FormFu for details.
106
107 type
108 Returns the "type" argument originally used to create the element.
109
111 render_processed_value
112 See "render_processed_value" in HTML::FormFu for details.
113
114 force_errors
115 See "force_errors" in HTML::FormFu for details.
116
118 See specific element types for which tag attributes are added to.
119
120 attributes
121 attrs
122 Arguments: [%attributes]
123
124 Arguments: [\%attributes]
125
126 Return Value: $form
127
128 See "attributes" in HTML::FormFu for details.
129
130 "attrs" is an alias for "attributes".
131
132 attributes_xml
133 attrs_xml
134 See "attributes_xml" in HTML::FormFu for details.
135
136 "attrs_xml" is an alias for "attributes_xml".
137
138 add_attributes
139 add_attrs
140 Arguments: [%attributes]
141
142 Arguments: [\%attributes]
143
144 Return Value: $form
145
146 See "add_attributes" in HTML::FormFu for details.
147
148 "add_attrs" is an alias for "add_attributes".
149
150 add_attributes_xml
151 add_attrs_xml
152 See "add_attributes_xml" in HTML::FormFu for details.
153
154 "add_attrs_xml" is an alias for "add_attributes_xml".
155
156 del_attributes
157 del_attrs
158 Arguments: [%attributes]
159
160 Arguments: [\%attributes]
161
162 Return Value: $form
163
164 See "del_attributes" in HTML::FormFu for details.
165
166 "del_attrs" is an alias for "del_attributes".
167
168 del_attributes_xml
169 del_attrs_xml
170 See "del_attributes_xml" in HTML::FormFu for details.
171
172 "del_attrs_xml" is an alias for "del_attributes_xml".
173
174 The following methods are shortcuts for accessing "attributes" keys.
175
176 id
177 Arguments: [$id]
178
179 Return Value: $id
180
181 Get or set the element's DOM id.
182
183 Default Value: none
184
186 See HTML::FormFu::Model for further details and available models.
187
188 model_config
189 Arguments: \%config
190
192 filename
193 This value identifies which template file should be used by "render" to
194 render the element.
195
196 prepare_id
197 Arguments: $render
198
199 See "prepare_id" in HTML::FormFu::Role::Element::Field for details.
200
201 prepare_attrs
202 Arguments: $render
203
204 See "prepare_attrs" in HTML::FormFu::Role::Element::Field for details.
205
206 render
207 Return Value: $string
208
210 parent
211 Returns the block element or form object that this element is attached
212 to.
213
214 get_parent
215 Arguments: \%options
216
217 my $repeatable = $field->get_parent({ type => 'Repeatable' });
218
219 Traverses the parent hierarchy, returning the first parent that matches
220 the supplied options.
221
222 form
223 Returns the HTML::FormFu object that the constraint's field is attached
224 to.
225
226 clone
227 See "clone" in HTML::FormFu for details.
228
230 tt_args
231 See "tt_args" in HTML::FormFu for details.
232
233 render_method
234 See "render_method" in HTML::FormFu for details.
235
237 HTML::FormFu::Element::Button
238 HTML::FormFu::Element::Checkbox
239 HTML::FormFu::Element::Checkboxgroup
240 HTML::FormFu::Element::ComboBox
241 HTML::FormFu::Element::ContentButton
242 HTML::FormFu::Element::Date
243 HTML::FormFu::Element::Email
244 HTML::FormFu::Element::File
245 HTML::FormFu::Element::Hidden
246 HTML::FormFu::Element::Image
247 HTML::FormFu::Element::Number
248 HTML::FormFu::Element::Password
249 HTML::FormFu::Element::Radio
250 HTML::FormFu::Element::Radiogroup
251 HTML::FormFu::Element::Reset
252 HTML::FormFu::Element::Select
253 HTML::FormFu::Element::Submit
254 HTML::FormFu::Element::Textarea
255 HTML::FormFu::Element::Text
256 HTML::FormFu::Element::URL
257
259 HTML::FormFu::Element::Blank
260 HTML::FormFu::Element::Block
261 HTML::FormFu::Element::Fieldset
262 HTML::FormFu::Element::Hr
263 HTML::FormFu::Element::Label
264 HTML::FormFu::Element::Multi
265 HTML::FormFu::Element::Repeatable
266 HTML::FormFu::Element::SimpleTable
267 HTML::FormFu::Element::Src
268
270 The following are base classes for other elements, and generally
271 needn't be used directly.
272
273 HTML::FormFu::Role::Element::Field
274 HTML::FormFu::Role::Element::Group
275 HTML::FormFu::Role::Element::Input
276 HTML::FormFu::Element::_MultiElement
277 HTML::FormFu::Element::_MultiSelect
278 HTML::FormFu::Element::_MultiText
279 HTML::FormFu::Role::Element::NonBlock
280
282 db
283 Has been removed; use "default_args" instead.
284
286 Carl Franks, "cfranks@cpan.org"
287
289 This library is free software, you can redistribute it and/or modify it
290 under the same terms as Perl itself.
291
293 Carl Franks <cpan@fireartist.com>
294
296 This software is copyright (c) 2018 by Carl Franks.
297
298 This is free software; you can redistribute it and/or modify it under
299 the same terms as the Perl 5 programming language system itself.
300
301
302
303perl v5.34.0 2022-01-21 HTML::FormFu::Element(3)