Debian Codegraph @

lib/HTML/FormHandler/Manual/Reference.pod

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