RE: [dfv] Re: [cgiapp] Filters don't seem to work with CGI::Application::Plugin::ValidateRM
Status: Inactive
Brought to you by:
markjugg
From: Dan H. <dan...@re...> - 2006-05-10 10:41:40
|
> On Behalf Of Ron Savage > Sent: Wednesday, 10 May 2006 20:40 > To: List - Data-FormValidator > Subject: [dfv] Re: [cgiapp] Filters don't seem to work with > CGI::Application::Plugin::ValidateRM > > > On Wed, 10 May 2006 18:26:46 +1200, Dan Horne wrote: > > Hi Dan > > > The whitespace isn't being trimmed at all. Any ideas? > > I don't see any trimming code in what you published :-(. > > -- > Cheers > Ron Savage, ro...@sa... on 10/05/2006 > http://savage.net.au/index.html Let the record show: > Microsoft is not an Australian company > > Sorry. Here you go: sub form_process { my $self = shift; my ($results,$err_page) = $self->check_rm('form_display', { required => [qw/full_name/], optional => [qw/ pet_name pet_food zipcode fav_color fav_music fav_language /], dependencies => { pet_food => [ 'pet_name'], }, constraints => { zipcode => 'zip', fav_language => '/Perl/i', }, # trim leading and trailing whitespace from all the valid fields. filters => ['trim'], msgs=>{ any_errors => 'err__', prefix=>'err_', }, }); return $err_page if $err_page; # Usually something is done with $results->valid here. return '<pre>'.Dumper({$self->query->Vars}).'</pre>'; } and here's the output: $VAR1 = { 'fav_music' => 'Rock N\' Roll', 'rm' => 'form_process', 'fav_color' => 'Blue', 'pet_food' => 'Organic Dog Crunchies', 'zipcode' => '12344', 'full_name' => 'Dan ', 'fav_language' => 'Perl', 'pet_name' => 'Fido ' }; |