PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

field validation

  1. I need to validate a field against another field, much like what has been done with the email fields. I need to make sure that the contents of field1 match the contents of field2. Is there any way to do this within gForms?

    Posted 12 years ago on Monday August 15, 2011 | Permalink
  2. Yes. You'd have to write custom validation using the gform_validation hook. This hook is documented here:

    http://www.gravityhelp.com/documentation/page/Gform_validation

    Posted 12 years ago on Monday August 15, 2011 | Permalink
  3. Ok, that's reasonably do-able. Now the question, what's the best way to approach this on a multi-site setup with gForms active on almost every site?

    Posted 12 years ago on Monday August 15, 2011 | Permalink
  4. Are the sites already active and you just want to replicate the new form across all existing sites? Or, do you want this new form to be present in all new sites created from this point forward?

    Posted 12 years ago on Tuesday August 16, 2011 | Permalink
  5. I think neither. I need to be able to do this on one form on one site in a multi-site installation. Specifically, I have a user information form on my Admissions website where I need to validate 2 fields against each other.

    I think my question is more "how do I implement this on a multi-site install where I'm using the same theme throughout the site and form id's may replicate between individual blogs". From what I can see, it lets you identify form fields and specific form id's, but when form1 on one site needs different validation from form1 on another site, using the same functions.php file, I smell a conundrum.

    I'm using Genesis and a single theme.

    Posted 12 years ago on Sunday August 28, 2011 | Permalink
  6. So in your multi-site installation, multiple sites use the same functions.php and same theme files? Can you post the URLs for two of the sites so I can see the differences? I'm sure there is some condition we can test for to make the code run on only one of the sites. I'm certain of it, but we need to find out what that unique thing will be.

    Do I understand the conundrum: you're planning on having Gravity Forms active on all (or many) sites in a multi-site installation, so the potential exists that a new site creating its first form, form 1, would conflict with this special form 1 you created, which has this custom validation. Is that correct?

    Posted 12 years ago on Sunday August 28, 2011 | Permalink
  7. twistystraws
    Member

    Hi

    As Shelley mentions in her original post, "much like what has been done with the email fields" - is there example code somewhere for this function? I need a double input of the email address, and for them to check against each other?

    Thanks

    Posted 12 years ago on Monday September 5, 2011 | Permalink
  8. twistystraws
    Member

    Just realised this is already built in by default as 'enable email confirmation' when adding an email field...

    Posted 12 years ago on Monday September 5, 2011 | Permalink

This topic has been resolved and has been closed to new replies.