meraxes has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks-of-unusual-size,
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:
dependencies => { 'same_as_billing' => { undef => [ qw/street1 street2 city/ ] }, }
I realize I could flip the meaning of the checkbox to be different_from_billing and I could easily do something like this:
dependencies => { different_from_billing => [ qw/street1 street2 city/ ], }
... 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?
Many thanks,
meraxes
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Data::FormValidator inverse dependencies?
by philcrow (Priest) on Nov 10, 2005 at 22:08 UTC |