|more useful options|
Data::FormValidator inverse dependencies?by meraxes (Friar)
|on Nov 10, 2005 at 21:48 UTC||Need Help??|
meraxes has asked for the
wisdom of the Perl Monks concerning the following question:
I've got a bit of a situtation with Data::FormValidator and a form... not sure what to do.
The form contains a checkbox called same_as_billing. If same_as_billing is checked that means re-use the billing address as the shipping address. Otherwise, I have to get shipping address information. That means I want Data::FormValidator to make some other fields required. Essentially, I want the inverse of the dependencies clause (since undef is not a valid hash key). So I know I can't do something like this:
I realize I could flip the meaning of the checkbox to be different_from_billing and I could easily do something like this:
... but Marketing dislikes the wording. Yay.
Manually tinkering with the POST/GET var before using Data::FormValidator is one way I could get around this by getting the inverse value but that seems messy and could confuse someone just looking at the code. Is there a way I can do this purely using DFV?