
Catalyst::Plugin::FormValidator::Simple - Validator for Catalyst with FormValidator::Simple

use Catalyst qw/FormValidator::Simple FillInForm/;
# set option
MyApp->config->{validator} = {
plugins => ['CreditCard', 'Japanese'],
options => { charset => 'euc'},
}
in your controller
sub defaulti : Private {
my ($self, $c) = @_;
$c->form(
param1 => [qw/NOT_BLANK ASCII/, [qw/LENGTH 4 10/]],
param2 => [qw/NOT_BLANK/, [qw/JLENGTH 4 10/]],
mail1 => [qw/NOT_BLANK EMAIL_LOOSE/],
mail2 => [qw/NOT_BLANK EMAIL_LOOSE/],
{ mail => [qw/mail1 mail2/] } => ['DUPLICATION'],
);
print $c->form->valid('param1');
if ( some condition... ) {
$c->form(
other_param => [qw/NOT_INT/],
);
}
if ( some condition... ) {
# set your original invalid type.
$c->form->set_invalid_form( param3 => 'MY_ERROR' );
}
if ( $c->form->has_missing || $c->form->has_invalid ) {
if ( $c->form->missing('param1') ) {
...
}
if ( $c->form->invalid( param1 => 'ASCII' ) ) {
...
}
if ( $c->form->invalid( param3 => 'MY_ERROR' ) ) {
...
}
}
}

This plugin allows you to validate request parameters with FormValidator::Simple. See FormValidator::Simple for more information.
This behaves like as Catalyst::Plugin::FormValidator.


Lyo Kato <lyo.kato@gmail.com>

Copyright(C) 2005 by Lyo Kato
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.