forked from gshank/html-formhandler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev_notes.txt
65 lines (57 loc) · 2.57 KB
/
dev_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
HTML::FormHandler
form object. contains roles to build fields and a Result object
HTML::FormHandler::BuildFields
Builds the field arrays. Used by HFH & Field::Compound
HTML::FormHandler::InitResult
Methods to initialize the fields
HTML::FormHandler::Fields
Attributes and methods for the Field arrays and accessors
Used by HFH and Field::Compound
HTML::FormHandler::Result
Result object that contains non-static data: input, value, errors
mostly implemented by HTML::FormHandler::Result::Role
HTML::FormHandller::Validate
Role that hold validation code (used in Field)
HTML::FormHandler::Validate::Action
Role that validates the action array (use in HFH & Field)
HTML::FormHandler::Field::Compound
Implements compound fields, mostly via the Fields role
HTML::FormHandler::Field::Repeatable
Implements repeatable fields
HTML::FormHandler::Widget::Field::Result
Field result object, mostly implemented by HTML::FormHandler::Field::Result
HTML::FormHandler::Types
Library of Moose types (not used internally)
HTML::FormHandler::Params
munges params from CGI style to hashes and arrays
HTML::FormHandler::Widget::ApplyRole
method to apply widget roles to HFH and Field
HTML::FormHandler::Widget::Form::*
form widgets
HTML::FormHandler::Widget::Field::*
field widgets
HTML::FormHandler::Widget::Wrapper::*
wrapper widgets
Form fields are filled in with input/value by _result_from_object if there's
an initial object or model object (row), by _result_from_input if
there are params, and by the '_result_from_fields' if there's neither an
initial object or params (such as when the form is empty).
There are three methods in InitResult (called by setup_form) to do the
field initialization:
_result_from_fields
_result_from_input
_result_from_object
If there are parameters (i.e. POST) then validation is performed.
validate_form in HFH calls _fields_validate in the Fields role.
Validation
validate_form (HFH)
fields_validate (Fields in HFH & Compound)
loop through fields doing 'validate_field' (TransformAndCheck in HFH & Field)
fields_validate ( if field is Compound (recursive))
_apply_actions (T&C)
validate (Field subclasses)
_validate (form method pointed to in Field)
The fields contain weak references to the result objects they contain. Each field
result object is chained to a parent result object in the _result_from methods.
Each field contains it's own _result_from methods. The Fields class contains the
methods for form and compound fields. Repeatable contains its own versions of these methods.