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


Catalyst-Plugin-FormValidator-Simple-OwnCheck documentation  | view source Contained in the Catalyst-Plugin-FormValidator-Simple-OwnCheck distribution.

Index


NAME

Top

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

SYNOPSIS

Top

    use Catalyst qw/FormValidator::Simple::OwnCheck FillInForm/;

    # set option
    MyApp->config->{validator} = {
        plugins 				=> ['CreditCard', 'Japanese'],
        plugins_owncheck 		=> ['MyApp::Checker'],
        options 				=> { charset => 'euc'},
    }

in your Checker.pm

	package MyApp::Checker;
	use strict;
	use FormValidator::Simple::Exception;
	use FormValidator::Simple::Constants;

	our $VERSION = '0.01';

	sub NUMBER {
		my ( $self, $params, $args ) = @_;

		my $is_number = $params->[0] =~ m{^\d+$} ? 1 : 0;
		return $is_number ? TRUE : FALSE;	
	} 
	1;  

in your controller

    sub defaulti : Private {

        my ($self, $c) = @_;

	#this will check the param1 whether is NOT_BLANK and is NUMBER
        $c->form(
            param1 => [ qw/NOT_BLANK/, 'NUMBER' ],
        );

	#...

    }

DESCRIPTION

Top

This plugin allows you to validate request parameters with a checker of your application namespace , no need to package your checker in the namespace of FormValidator::Simple. See FormValidator::Simple for more information.

This behaves like as Catalyst::Plugin::FormValidator.

SEE ALSO

Top

FormValidator::Simple

Catalyst

AUTHOR

Top

ADONG <lt>dxluo83@gmail.com<gt>

COPYRIGHT AND LICENSE

Top


Catalyst-Plugin-FormValidator-Simple-OwnCheck documentation  | view source Contained in the Catalyst-Plugin-FormValidator-Simple-OwnCheck distribution.