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


In reply to Data::FormValidator inverse dependencies? by meraxes

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.