1HTML::FormHandler::ManuUasle:r:FCroonmtDrFiVb(u3t)ed PerHlTMDLo:c:uFmoernmtHaatnidolner::Manual::FromDFV(3)
2
3
4
6 HTML::FormHandler::Manual::FromDFV - converting from
7 Data::FormValidator
8
10 version 0.40068
11
13 Manual Index
14
15 Cheatsheet for converting from Data::FormValidator.
16
18 Information that's useful when switching from Data::FormValidator to
19 HTML::FormHandler. There's not a lot here yet, so if you have something
20 to add, patches are welcome.
21
22 In a general way, FormHandler doesn't have nearly so many "special"
23 checks as Data::FormValidator. It would be possible to implement many
24 of them, but there hasn't been much demand for them. So far FormHandler
25 users seem to be satisfied with the "do your own checks in a Perl
26 method" solution. Because of the greater complexity of FormHandler's
27 data model - with Repeatable arrays and nested compounds, etc - it's
28 somewhat harder to do some of them automatically.
29
31 dependencies
32 In FormHandler, 'dependency' is the equivalent of
33 'dependency_group', without the key names.
34
35 The other variations of dependencies in DFV are not implemented in
36 FormHandler, and would normally be done in a form's 'validate' sub.
37
38 trim, filters
39 A 'trim' filter is installed by default in FormHandler; it's a
40 special version of an apply action, and can be set to a transform
41 or Moose type. See the documentation in
42 HTML::FormHandler::Field#trim.
43
44 Transforms and inflations/deflations do not change what is
45 presented in the form unless you set the 'fif_from_value' flag on
46 the field.
47
48 FV_length_between, FV_max_length, FV_min_length
49 Use text fields with 'minlength' and 'maxlength' attributes.
50
51 FV_eq_with
52 Perform your own checks in the form 'validate' sub.
53
54 sub validate {
55 my $self = shift;
56 if( $self->field('one')->value eq $self->field('two')->value ) {
57 }
58 }
59
61 The simple constraints from Data::FormValidator::Constraints can be
62 used directly in a FormHandler form:
63
64 use Data::FormValidator::Constraints ('match_state');
65 has_field 'my_state' => (
66 apply => [ { check => \&match_state, message => 'Invalid State' } ] );
67
68 email
69 Use the 'Email' field type, or use the FH Moose Type, 'email'.
70
71 has_field 'email' => ( type => 'Email' );
72 -- or --
73 use HTML::FormHandler::Types ('Email');
74 has_field 'email' => ( apply => [ Email ] );
75
77 FormHandler Contributors - see HTML::FormHandler
78
80 This software is copyright (c) 2017 by Gerda Shank.
81
82 This is free software; you can redistribute it and/or modify it under
83 the same terms as the Perl 5 programming language system itself.
84
85
86
87perl v5.36.0 2022-07-H2T2ML::FormHandler::Manual::FromDFV(3)