NAME
Form::Factory::Feature::RequireNoneOrAll - if one control has a value, all should
VERSION
version 0.022
SYNOPSIS
package MyApp::Action::Foo;
use Form::Factory::Processor;
use_feature require_none_or_all => {
groups => {
password => [ qw(
old_password
new_password
confirm_password
) ],
},
};
has_control old_password => (
control => 'password',
prediate => 'has_old_password',
);
has_control new_password => (
control => 'password',
);
has_control confirm_password => (
control => 'password',
);
sub run {
my $self = shift;
if ($self->has_old_password) {
# change password, we know new_password and confirm_password are set
}
}
DESCRIPTION
This feature allows you to make groups of controls work together. If any one of the named controls have a value when checked, then all of them must or the form will be invalid and an error will be displayed.
ATTRIBUTES
groups
This is how the control groups are configured. Each key is used to name a control group and the values are arrays of controls that are grouped together. This way more than one none-or-all requirement can be set on a given form.
At this time, the control group names are ignored, but might be used in the future for linking additional settings together.
METHODS
check
This runs the checks to make sure that for each group of controls, either all have a value or none do.
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Qubling Software LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.