1HTML::FormHandler::ManuUasle:r:RCeofnetrreinbcuet(e3d)PHeTrMlL:D:oFcourmmeHnatnadtlieorn::Manual::Reference(3)
2
3
4
6 HTML::FormHandler::Manual::Reference - concise reference
7
9 version 0.40068
10
12 Manual Index
13
14 This is a concise reference of HTML::FormHandler.
15
16 HTML::FormHandler has a lot of options and many ways to customize your
17 forms. More complete documentation can be found in the rest of the
18 manual as HTML::FormHandler::Manual and in HTML::FormHandler,
19 HTML::FormHandler::Field, HTML::FormHandler::Model::DBIC,
20 HTML::FormHandler::Render::Simple, and in the individual field classes.
21
23 Form Attributes
24 params HTTP parameters; if present validation will be attempted
25 name Form name. Used in 'id' of form element
26
27 field_name_space Where to search for fields
28 widget_name_space Where to search for widgets
29
30 language handle For MakeText
31 ctx Application context for your use
32
33 init_object For default values instead of $item
34 dependency Array of arrays of field names. If one name has a value, all
35 fields in the list are set to 'required'
36
37 fields Field array
38 sorted_fields The sorted array of fields
39 field( $name ) Returns a field object
40 has_field Moose-y sugar for declaring fields
41 field_list Non-moose-y way to define fields
42
43 clear Resets state. Used in persistent forms.
44 value Returns a hashref of values (with accessor keys)
45 fif Returns a hashref for filling in form
46
47 Form database attributes
48 item DB row object
49 item_class Class of db item
50 item_id Primary key of db item
51 schema Schema of item
52
53 Also 'update_model' sub
54
55 Form processing
56 process Sets up form, validates, updates model
57 run Returns a result object and clears form
58 update_field_list Updates to fields on process
59 posted Flag to say whether or not to validate, instead of
60 depending on presence of params
61
62 Validation
63
64 validate Sub for validation after individual fields are validated
65 validate_model Sub for additional database type validation
66 validated Flag that form has validated
67 is_valid Synonym of 'validated'
68 ran_validation Flag that validation has already been run
69 dependency Set groups of fields that are set to required if one is present
70 validate_$fieldname Validation routine for field (also 'validate_method')
71
72 Errors
73
74 has_errors True if any field has errors
75 num_errors The number of errors (field errors + form errors)
76 error_fields An array of fields with errors
77 errors Returns an array of all errors
78 error_field_names Returns an array of field names with errors
79
80 Form Methods and process hooks
81
82 update_model To perform additional database actions on update
83 update_fields Sub providing convenient place to update fields on 'process'
84 update_subfields Sub providing place to update fields on Build (useful for
85 roles and compound field classes)
86 init_object can be a method instead of an attribute
87
88 Form Rendering
89
90 html_prefix Flag to prefix html field names with the form name.
91 Useful for multiple instances of the same form
92 do_form_wrapper flag to wrap form. (build_do_form_wrapper)
93 form_tags Various strings and flags used by rendering
94 form_element_attr For arbitrary html attributes in the 'form' tag
95 form_element_class Arrayref of classes for 'class="..."' in form element
96 form_wrapper_attr For arbitrary html attributes on the form wrapper
97 form_wrapper_class Arrayref of classes for 'class="..."' in form wrapper
98 http_method For storing 'post' or 'get'
99 action Store the form 'action' on submission. No default value.
100 enctype Request enctype
101 uuid generates a string containing an HTML field with UUID
102 style adds a 'style' attribute to the form tag
103 id the form tag 'id' attribute is set to the form name
104 html_attributes hook that allows customizing html attributes (form & field)
105
106 Field specific form methods
107 options_$fieldname Sub returning options array (also 'options_method')
108 validate_$fieldname Validation routine for field (also 'validate_method')
109 default_$fieldname Set default for field (also 'default_method')
110
112 Field attributes
113 name Field name. Must be the same as database column name or rel
114 type Field type. From a Field class: 'Text', 'Select', etc
115 order Set the order for fields. Default order is set by FH.
116
117 dump For debugging
118 active Arrayref of fields to set active
119 is_active
120 inactive Arrayref of fields to set inactive
121 is_inactive
122 input_without_param The value of the field if there is no input from the submitted form
123
124 default Default value for the field
125 default_method Coderef to set default or 'default_$fieldname' (by default)
126 not_nullable Don't convert an empty field ('', etc) to undef
127
128 trim Transform to trim the field
129 deflation Function to deflate the field (in 'apply') (opposite of transform)
130 deflate_method Coderef to deflate the field (for filling in the form)
131 inflate_method Coderef to inflate the field (before validation)
132 inflate_default_method Coderef to inflate value from item/init_object
133 deflate_value_method Coderef to deflate value after validation
134 fif_from_value Flag to use 'value' of field for 'fif'.
135
136 password Remove from params and do not display in forms.
137
138 Select fields
139 options Sorted array of hashes; keys: "value", "label"
140 options_method
141 label_column Column to use for labels (default: name)
142 active_column Which values to list in options
143 sort_column Column to use for sorting (default: label_column)
144
145 Field errors
146 errors Errors associated with this field
147 (also num_errors, clear_errors, has_errors, add_error)
148 messages Hashref of message identifiers and text
149
150 Field validation
151 apply Array of constraint/coercion/transformation actions
152 ( type, check, transform, message, when )
153 validate_method Validation coderef, or 'validate_$fieldname' in form (default)
154 required Field is required
155 required_when Takes a hashref of field name keys and values
156 missing Flag set when a 'required' or 'required_when' fails
157 maxlength Text fields. Validated.
158 minlength Text fields. Used in validation
159 range_start Range start for number fields
160 range_end Range end for number fields
161
162 Field attributes for DB
163 accessor Database accessor name if different than field name
164 unique Field should be unique in the database
165 noupdate Don't update this field in the database
166 writeonly Do not retrieve initial values
167
168 Also see the select field _columns attributes
169
170 Field rendering
171 widget Determines which rendering widget to use for the field
172 widget_wrapper Which wrapper widget to apply to the field
173 element_attr Hashref to store arbitrary html attributes.
174 label_attr Hashref for html attributes for the label
175 wrapper_attr Hashref for html attributes for the wrapping element (div, etc)
176 element_class Arrayref for classes for the form element
177 wrapper_class Arrayref for classes for the form element wrapper
178 label_class Arrayref for classes for the form element label
179 label Text label for this field. Defaults to ucfirst field name.
180 build_label_method provide a builder for 'label' attribute
181 wrap_label_method provide a coderef to wrap the label
182 id Useful for javascript (default is html_name. to prefix with
183 form name, use 'html_prefix' in your form)
184 build_id_method Provide a builder for 'id' attribute
185 do_wrapper Flag to render wrapper
186 do_label Flag to render label
187 size Text & select fields.
188
189 render Widget method to render the field ($field->render)
190 renderx "" plus set attributes ($field->render( element_class => '...' ))
191 render_element Widget method to render unwrapped field ($field->render_element)
192 render_elementx "" plus set attributes ($field->render_elementx( element_class => '...'))
193
194 Field attributes managed by FormHandler
195 These attributes are usually accessed in a subroutine or in a template,
196 but are usually set only by FormHandler. ('value' may be changed as a
197 transform _in a validation routine_.)
198
199 init_value Initial value from the database
200 value The value of your field.
201 input Input value from parameter or initial value from database
202 fif Retrieve (do not set) values for filling in a form
203
205 FormHandler Contributors - see HTML::FormHandler
206
208 This software is copyright (c) 2017 by Gerda Shank.
209
210 This is free software; you can redistribute it and/or modify it under
211 the same terms as the Perl 5 programming language system itself.
212
213
214
215perl v5.32.0 2020-0H7T-M2L8::FormHandler::Manual::Reference(3)