[cgiapp] Confused with ValidateRM

fREW Schmidt frioux at gmail.com
Fri Apr 3 16:58:41 EDT 2009


Hi all!
I would like to add a new filter for my validations and I can't seem to
figure out how.  I've tried including my filter module directly in my base
controller, but that doesn't seem to help.  Here is my filter module (based
off of the existing image filter):

package Data::FormValidator::Filters::Checkbox;
>

> use strict;
>
use warnings;
>

> use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
>

> BEGIN {
>
    require Exporter;
>

>     $VERSION = '0.01';
>

>     @ISA = qw( Exporter );
>

>     @EXPORT    = ();
>
    @EXPORT_OK = qw( checkbox_filter );
>
}
>

> sub checkbox_filter {
>
    return sub { return __checkbox( shift ) };
>
}
>

> sub __checkbox {
>
    my $value         = shift;
>
    if ($value eq 'on') {
>
       return 1;
>
    } else {
>
       return 0;
>
    }
>
}
>

> 1;
>

How can I get ValidateRM to recognize something like
field_filters => {
  foo => 'checkbox'
}


?

Thanks much!
-- 
fREW Schmidt
http://blog.afoolishmanifesto.com


More information about the cgiapp mailing list