Lyo Kato > Catalyst-Plugin-FormValidator-Simple-0.03 > Catalyst::Plugin::FormValidator::Simple

Download:
Catalyst-Plugin-FormValidator-Simple-0.03.tar.gz

Dependencies

Annotate this POD (5)

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.03   Source   Latest Release: Catalyst-Plugin-FormValidator-Simple-0.15

NAME ^

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

SYNOPSIS ^

    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' ) ) {
                ...
            }

        }
    }

DESCRIPTION ^

This plugin allows you to validate request parameters with FormValidator::Simple. See FormValidator::Simple for more information.

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

SEE ALSO ^

FormValidator::Simple

Catalyst

AUTHOR ^

Lyo Kato <lyo.kato@gmail.com>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: