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.

Match Fields

  1. AB
    Member

    I have a form and two of the fields are "Account Number" and Re-enter Account Number". I need to make the form require those two fields to match before a user can submit. How do I do this with GF?

    Posted 7 years ago on Tuesday September 18, 2012 | Permalink
  2. Hi AB. I have done this before. Please see here:
    http://gravity.chrishajer.com/check-your-ticket-number/

    I think that does exactly what you want. Here is the code to make that happen: http://pastebin.com/FqsWDDa4

    Please let us know if you have any questions.

    Posted 7 years ago on Tuesday September 18, 2012 | Permalink
  3. AB
    Member

    Thanks, I used your code and changed the input_ids to match mine, but it's trying to match input_1 and input_2 instead of input_2 and input_3 (which I changed it to do).

    Posted 7 years ago on Tuesday September 18, 2012 | Permalink
  4. Sounds like something is not configured correctly. Can you post all the code you are using at pastebin.com or pastie.org and I will take a look at it? It did work before.

    Posted 7 years ago on Tuesday September 18, 2012 | Permalink
  5. AB
    Member

    Here is my pastebin:
    http://pastebin.com/LuEWpD7n

    Posted 7 years ago on Tuesday September 18, 2012 | Permalink
  6. Take a look at the inline comments on lines 11 and 14. You need to use $form['fields'][1] and $form['fields'][2]. It's a zero based array, so fields 0 and fields 1 are input_1 and input_2. Change lines 12, 13, 15 and 16 and you will be good to go.

    Posted 7 years ago on Tuesday September 18, 2012 | Permalink
  7. AB
    Member

    Thank you, that worked. I had to change those numbers to the order in which those inputs display on my form.

    Posted 7 years ago on Tuesday September 18, 2012 | Permalink
  8. Right. Glad you got that worked out.

    Posted 7 years ago on Tuesday September 18, 2012 | Permalink

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