HTML::FormFu::Constraint - Constraint Base Class
--- elements: - type: text name: foo constraints: - type: Length min: 8 - type: text name: bar constraints: - Integer - Required constraints: - SingleValue
constraints() and constraint can be called on any form, block element (includes fieldsets) or field element.
constraints()
constraint
If called on a field element, no name argument should be passed.
name
If called on a form or block element, if no name argument is provided, a new constraint is created for and added to every field on that form or block.
See "FORM LOGIC AND VALIDATION" in HTML::FormFu for further details.
Returns the type argument originally used to create the constraint.
type
If true, inverts the results of the constraint - such that input that would otherwise fail will pass, and vise-versa.
This value is ignored by some constraints - see the documentation for individual constraints for details.
Arguments: $string
Set the message which will be displayed if the constraint fails.
Variant of "message" which ensures the value won't be XML-escaped.
Variant of "message" which uses localize to create the message.
Provide arguments that should be passed to localize to replace [_1], [_2], etc. in the localized string.
[_1]
[_2]
Returns the HTML::FormFu::Element::_Field object that the constraint is associated with.
Returns the HTML::FormFu object that the constraint's field is attached to.
Shorthand for $constraint->parent->name
$constraint->parent->name
Carl Franks, cfranks@cpan.org
cfranks@cpan.org
Based on the original source code of HTML::Widget::Constraint, by Sebastian Riedel, sri@oook.de.
sri@oook.de
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::FormFu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::FormFu
CPAN shell
perl -MCPAN -e shell install HTML::FormFu
For more information on module installation, please visit the detailed CPAN module installation guide.