CGI::Application::Plugin::FormValidator::Simple - Validator for CGI::Application with FormValidator::Simple
use CGI::Application::Plugin::FormValidator::Simple; $self->validator( plugins => [ 'Japanese', 'Number::Phone::JP' ], options => { charset => 'euc', }, messages => { user => { param1 => { NOT_BLANK => 'Input name!', ASCII => 'Input name with ascii code!', }, mail1 => { DEFAULT => 'email is wrong.!', NOT_BLANK => 'input email.!' }, }, company => { param1 => { NOT_BLANK => 'Input name!', }, }, }, ); $self->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 $self->form->valid('param1'); if ( some condition... ) { $self->form( other_param => [qw/NOT_INT/], ); } if ( $self->form->has_missing || $self->form->has_invalid ) { if ( $self->form->missing('param1') ) { ... } if ( $self->form->invalid( param1 => 'ASCII' ) ) { ... } if ( $self->form->invalid( param3 => 'MY_ERROR' ) ) { ... } }
This plugin for CGI::Application allows you to validate request parameters with FormValidator::Simple. See FormValidator::Simple for more information.
FormValidator::Simple
Catalyst::Plugin::FormValidator::Simple
CGI::Application
Gosuke Miyashita, <gosukenator@gmail.com>
Copyright (C) 2005 by Gosuke Miyashita
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
To install CGI::Application::Plugin::FormValidator::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Application::Plugin::FormValidator::Simple
CPAN shell
perl -MCPAN -e shell install CGI::Application::Plugin::FormValidator::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.