Hey,

I just started using this module (Data::Formvalidator) to carry out my form validation. For those experienced using this, have you ever validated a phone number that had three input fields? - -

I looked in the Data::FormValidator::Contraints referrence page and all I came up to try was this:

require_some => { # require any two fields from this group city_or_state_or_zipcode => [ 2, qw/city state zipcode/ ], } So I tried doing: require_some => { # require any two fields from this group american_phone => [ 2, qw/p1 p2 p3/ ], #the input field names are +p1 p2 p3, american_phone is the constraint name. }
I've also tried this the reversed way where constraint, american_phone is the key.

Inside the form profile, I tried placing this code inside the constraint hash, a separate hash, and inside the required hash.

Any help is appreciated. If there is no other way to do this, I might just try making a custom constraint and verifying each input filed, p1 p2 p3.

Thanks,
Anthony

In reply to using Data::FormValidator to validate phone numbers by perleager

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.