|The stupid question is the question not asked|
Mulitple constraints for Data::FormValidatorby Anneq (Vicar)
|on Apr 16, 2004 at 21:41 UTC||Need Help??|
Anneq has asked for the
wisdom of the Perl Monks concerning the following question:
I'm using Data::FormValidator, which has saved me many lines of code and has greatly simplified my validation logic. Excellent module.
However, due my lack of Perl experience, I'm having trouble creating a D::FV profile to apply multiple constraints to a single query parameter. I've searched the POD, perlmonks and googled but didn't find anything that helped me see how to do it. Here is a snippet of what I've got so far:
Using the code above, as I fully expected it to, the userid_untaint constraint is overriding the userid_exists constraint, because the second instance of the userid hash key is trashing the first. This is clear from my results. I get the "User ID contains bad stuff" error and the already existing user gets registered. If I remove the userid_untaint constraint, I get the expected error message "User ID already exists."
Does anyone know the proper syntax to write multiple constraints for a single variable?