|
NAMEGantry::Utils::FormErrors - A CRUD form validation error objectSYNOPSISA typical example:use Gantry::Plugins::CRUD; use Gantry::Utils::FormErrors; my $crud_obj = Gantry::Plugins::CRUD->new( #... validator => \&my_validator, ); sub my_validator { my $opts = shift; my $params = $opts->{ params }; my $form = $opts->{ form }; my %missing; my @errors; if ( not $params->{ password } ) { $missing{ password }++; } if ( $params->{ password } =~ /$params->{ user_name }/ ) { push @errors, 'Password cannot contain user name'; } # ... other similar tests my $error_text = join "\n<br /><b>Error:</b> ", @errors; $form->{ error_text } = $error_text; return Gantry::Utils::FormErrors->new( { missing => \%missing, } ); } The rest is handled by the CRUD plugin and the default template (form.tt). DESCRIPTIONThis module provides objects which respond to the same API as Data::FormValidator::Results (or at least the parts of that API which Gantry normally uses).Use this module in your Gantry::Plugins::CRUD validator callback. METHODS
AUTHORPhil Crow, <philcrow2000@yayoo.com<gt>COPYRIGHT AND LICENSECopyright (C) 2006 Phil CrowThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
Visit the GSP FreeBSD Man Page Interface. |