1HTML::FormHandler::FielUds:e:rCoCmopnoturnidb(u3t)ed PerHlTMDLo:c:uFmoernmtHaatnidolner::Field::Compound(3)
2
3
4
6 HTML::FormHandler::Field::Compound - field consisting of subfields
7
9 version 0.40068
10
12 This field class is designed as the base (parent) class for fields with
13 multiple subfields. Examples are HTML::FormHandler::Field::DateTime and
14 HTML::FormHandler::Field::Duration.
15
16 A compound parent class requires the use of sub-fields prepended with
17 the parent class name plus a dot
18
19 has_field 'birthdate' => ( type => 'DateTime' );
20 has_field 'birthdate.year' => ( type => 'Year' );
21 has_field 'birthdate.month' => ( type => 'Month' );
22 has_field 'birthdate.day' => ( type => 'MonthDay');
23
24 If all validation is performed in the parent class so that no
25 validation is necessary in the child classes, then the field class
26 'Nested' may be used.
27
28 The array of subfields is available in the 'fields' array in the
29 compound field:
30
31 $form->field('birthdate')->fields
32
33 Error messages will be available in the field on which the error
34 occurred. You can access 'error_fields' on the form or on Compound
35 fields (and subclasses, like Repeatable).
36
37 The process method of this field runs the process methods on the child
38 fields and then builds a hash of these fields values. This hash is
39 available for further processing by "actions" in
40 HTML::FormHandler::Field and the validate method.
41
42 widget
43 Widget type is 'compound'
44
45 build_update_subfields
46 You can set 'defaults' or other settings in a 'build_update_subfields'
47 method, which contains attribute settings that will be merged with
48 field definitions when the fields are built. Use the 'by_flag' key with
49 'repeatable', 'compound', and 'contains' subkeys, or use the 'all' key
50 for settings which apply to all subfields in the compound field.
51
53 FormHandler Contributors - see HTML::FormHandler
54
56 This software is copyright (c) 2017 by Gerda Shank.
57
58 This is free software; you can redistribute it and/or modify it under
59 the same terms as the Perl 5 programming language system itself.
60
61
62
63perl v5.34.0 2022-01-H2T1ML::FormHandler::Field::Compound(3)