[cgiapp] Data.FormValidator.js - New C::A validation plugin

Lyle webmaster at cosmicperl.com
Tue Jan 27 20:59:00 EST 2009


Lyle wrote:
> Joshua Miller wrote:
>>> Joshua,
>>>  Have you managed to figure out a work around for:-
>>>
>>> 'constraints' => {
>>>           'password1' => {
>>>               'constraint' => "check_passwords",
>>>               'params'     => [ qw( password1 password2 ) ],
>>>             },
>>>         },
>>>  ...
>>>  sub check_passwords {
>>>   my ( $pw1, $pw2 ) = @_;
>>>   if ( $pw1 eq $pw2 ) {
>>>     return 1;
>>>   } else {
>>>     return 0;
>>>   }
>>>  }

I've just tried this code in DFV and I can't get it working? I'm getting 
the error
"No constraint found named 'must_match' at Data/FormValidator/Results.pm 
line 965."

Can't seem to figure out what I'm missing...

Should be working according to the guide I followed at:-
http://search.cpan.org/~purdy/Data-FormValidator-Tutorial-1.61/lib/Data/FormValidator/Tutorial.pm

Has anyone got this working? Do I have to put the sub in a special 
package or pass it to DFV in some way?


Lyle



More information about the cgiapp mailing list