1HTML::FormFu::Element(3U)ser Contributed Perl DocumentatiHoTnML::FormFu::Element(3)
2
3
4

NAME

6       HTML::FormFu::Element - Element Base Class
7

SYNOPSIS

9           ---
10           elements:
11             - type: Text
12               name: username
13               constraints:
14                 - type: Required
15
16             - type: Password
17               name: password
18               constraints:
19                 - type: Required
20                 - type: Equal
21                   others: repeat-password
22
23             - type: Password
24               name: repeat-password
25
26             - type: Submit
27

DESCRIPTION

29       Elements are the basic building block of all forms. Elements may be
30       logical form-fields, blocks such as "div"s and "fieldset"s, non-blocks
31       such as "hr"s and other special elements such as tables.
32
33       For simple, automatic handling of fieldsets see the "auto_fieldset" in
34       HTML::FormFu setting.
35
36       See "deflators" in HTML::FormFu for details of Deflators.
37
38       See "FORM LOGIC AND VALIDATION" in HTML::FormFu for details of Filters,
39       Constraints, Inflators, Validators and Transformers.
40

METHODS

42   name
43       For field element, this value is used as the "name" attribute which the
44       field's value is associated with.
45
46       For all elements, the "name" value can be useful for identifying and
47       retrieving specific elements.
48
49   is_field
50       Return Value: boolean
51
52       Returns "true" or "false" depending on whether the element is a logical
53       form-field.
54
55       This is used by "get_fields" in HTML::FormFu.
56

BUILDING AN ELEMENT

58   load_config_file
59       Arguments: $filename
60
61       Arguments: \@filenames
62
63       Populate an element using a config file:
64
65           ---
66           elements:
67             - type: Block
68               load_config_file: 'elements.yml'
69
70       See "load_config_file" in HTML::FormFu for further details.
71
72   load_config_filestem
73       Arguments: $filestem
74
75       Arguments: \@filestems
76
77       Like "load_config_file", but you shouldn't include the file extension
78       in the passed string. This allows you to change your config-file type,
79       without having to change the code that loads the files.
80
81   config_file_path
82       Arguments: $directory_name
83
84       "config_file_path" defines where configuration files will be searched
85       for, if an absolute path is not given to "load_config_file".
86
87       Default Value: not defined
88
89       This method is a special 'inherited accessor', which means it can be
90       set on the form, a block element or a single element. When the value is
91       read, if no value is defined it automatically traverses the element's
92       hierarchy of parents, through any block elements and up to the form,
93       searching for a defined value.
94
95   config_callback
96       See "config_callback" in HTML::FormFu for details.
97
98   populate
99       See "populate" in HTML::FormFu for details.
100
101   stash
102       See "stash" in HTML::FormFu for details.
103
104   type
105       Returns the "type" argument originally used to create the element.
106

CHANGING DEFAULT BEHAVIOUR

108   render_processed_value
109       See "render_processed_value" in HTML::FormFu for details.
110
111   force_errors
112       See "force_errors" in HTML::FormFu for details.
113

ELEMENT ATTRIBUTES

115       See specific element types for which tag attributes are added to.
116
117   attributes
118   attrs
119       Arguments: [%attributes]
120
121       Arguments: [\%attributes]
122
123       Return Value: $form
124
125       See "attributes" in HTML::FormFu for details.
126
127       "attrs" is an alias for "attributes".
128
129   attributes_xml
130   attrs_xml
131       See "attributes_xml" in HTML::FormFu for details.
132
133       "attrs_xml" is an alias for "attributes_xml".
134
135   add_attributes
136   add_attrs
137       Arguments: [%attributes]
138
139       Arguments: [\%attributes]
140
141       Return Value: $form
142
143       See "add_attributes" in HTML::FormFu for details.
144
145       "add_attrs" is an alias for "add_attributes".
146
147   add_attributes_xml
148   add_attrs_xml
149       See "add_attributes_xml" in HTML::FormFu for details.
150
151       "add_attrs_xml" is an alias for "add_attributes_xml".
152
153   del_attributes
154   del_attrs
155       Arguments: [%attributes]
156
157       Arguments: [\%attributes]
158
159       Return Value: $form
160
161       See "del_attributes" in HTML::FormFu for details.
162
163       "del_attrs" is an alias for "del_attributes".
164
165   del_attributes_xml
166   del_attrs_xml
167       See "del_attributes_xml" in HTML::FormFu for details.
168
169       "del_attrs_xml" is an alias for "del_attributes_xml".
170
171       The following methods are shortcuts for accessing "attributes" keys.
172
173   id
174       Arguments: [$id]
175
176       Return Value: $id
177
178       Get or set the element's DOM id.
179
180       Default Value: none
181

MODEL / DATABASE INTERACTION

183       See HTML::FormFu::Model for further details and available models.
184
185   model_config
186       Arguments: \%config
187

RENDERING

189   filename
190       This value identifies which template file should be used by "render" to
191       render the element.
192
193   prepare_id
194       Arguments: $render
195
196       See "prepare_id" in HTML::FormFu::Element::_Field for details.
197
198   prepare_attrs
199       Arguments: $render
200
201       See "prepare_attrs" in HTML::FormFu::Element::_Field for details.
202
203   render
204       Return Value: $string
205

INTROSPECTION

207   parent
208       Returns the block element or form object that this element is attached
209       to.
210
211   get_parent
212       Arguments: \%options
213
214           my $repeatable = $field->get_parent({ type => 'Repeatable' });
215
216       Traverses the parent hierarchy, returning the first parent that matches
217       the supplied options.
218
219   form
220       Returns the HTML::FormFu object that the constraint's field is attached
221       to.
222
223   clone
224       See "clone" in HTML::FormFu for details.
225

ADVANCED CUSTOMISATION

227   tt_args
228       See "tt_args" in HTML::FormFu for details.
229
230   render_method
231       See "render_method" in HTML::FormFu for details.
232

CORE FORM FIELDS

234       HTML::FormFu::Element::Button
235       HTML::FormFu::Element::Checkbox
236       HTML::FormFu::Element::Checkboxgroup
237       HTML::FormFu::Element::ComboBox
238       HTML::FormFu::Element::ContentButton
239       HTML::FormFu::Element::Date
240       HTML::FormFu::Element::File
241       HTML::FormFu::Element::Hidden
242       HTML::FormFu::Element::Image
243       HTML::FormFu::Element::Number
244       HTML::FormFu::Element::Password
245       HTML::FormFu::Element::Radio
246       HTML::FormFu::Element::Radiogroup
247       HTML::FormFu::Element::Reset
248       HTML::FormFu::Element::Select
249       HTML::FormFu::Element::Submit
250       HTML::FormFu::Element::Textarea
251       HTML::FormFu::Element::Text
252

OTHER CORE ELEMENTS

254       HTML::FormFu::Element::Blank
255       HTML::FormFu::Element::Block
256       HTML::FormFu::Element::Fieldset
257       HTML::FormFu::Element::Hr
258       HTML::FormFu::Element::Label
259       HTML::FormFu::Element::Multi
260       HTML::FormFu::Element::Repeatable
261       HTML::FormFu::Element::SimpleTable
262       HTML::FormFu::Element::Src
263

ELEMENT BASE CLASSES

265       The following are base classes for other elements, and generally
266       needn't be used directly.
267
268       HTML::FormFu::Element::_Field
269       HTML::FormFu::Element::_Group
270       HTML::FormFu::Element::_Input
271       HTML::FormFu::Element::_MultiElement
272       HTML::FormFu::Element::_MultiSelect
273       HTML::FormFu::Element::_MultiText
274       HTML::FormFu::Element::_NonBlock
275

DEPRECATED METHODS

277   db
278       Is deprecated and provided only for backwards compatibility. Will be
279       removed at some point in the future.
280
281       Use "model_config" instead.
282

AUTHOR

284       Carl Franks, "cfranks@cpan.org"
285

LICENSE

287       This library is free software, you can redistribute it and/or modify it
288       under the same terms as Perl itself.
289
290
291
292perl v5.12.1                      2010-05-23          HTML::FormFu::Element(3)
Impressum