stepamil has asked for the wisdom of the Perl Monks concerning the following question:
Hi PerlMonks,
I've been playing with Validation::Class and it looks really good. Centralized validation and everything. But, my question is how do I validate array ref, like this:
{ conds => { ids => [ 2342, 2311, 4567 ] } }I tried like this:
field 'conds.ids' => { error => { code => 'CONDS_IDS', details => 'Validation error on c +onds.ids' }, required => 1, validation => sub { my ( $self, $this_field, $all_params ) = @_; if ( $this_field->{value} && ( ref( $this_field->{value} ) eq 'ARRAY' ) ) { return 1; } return 0; } };
and the error was something like this:
Data validation field conds.ids:2 does not exist
Is this validation possible at all?
Thanks, Stepamil
|
|---|