Monday to Friday
10am to 6pm
Call us now on 02380 000567
 

13 Comments

Leave a comment
  1. Bri December 28, 2010 at 10:48 pm #

    This is awesome! Took me a little while to figure out how to change the code to get it to work but I got it.

    • Dan Harrison December 30, 2010 at 1:30 am #

      Would love to know what you needed to change…

      Thanks
      Dan

  2. johnny January 9, 2011 at 11:10 am #

    where is this added in wordpress?

    in the themefunctions file (functions.php) ?

  3. johnny January 9, 2011 at 11:38 am #

    Ok i figured out that the code above has to be added to the functions.php file.

    keep in mind that if you use the gravity forms advanced fields that counting the fields may be different.
    For example i used the advanced address field, which had street address, city, zip etc… but only counts as 1 field. So when entering the index be careful.
    the best way to find out what the index is for the fields you are trying to match is to change the error index to see where the error appears.

  4. johnny January 9, 2011 at 11:39 am #

    by the way the next version of gravity forms (1.5) has email matching built in to the advanced email field.

    the current beta release is too buggy for me to use tho (1.5 RC3).

    • Dan Harrison January 10, 2011 at 12:32 pm #

      Thanks Johnny, I’ll make a note to update the post when V1.5 of GF comes out. :)

      Dan

  5. Mistry April 4, 2011 at 11:21 pm #

    Thanks for the function – read all the way to end only to discover that it may be included in 1.5 – just got that version now! hopefully it works! :)

    • Dan Harrison April 5, 2011 at 9:24 am #

      Thanks Mistry. I’ve confirmed this and updated the article accordingly.

      Dan

  6. Jack Walter April 24, 2011 at 11:57 pm #

    Hi Dan,

    I prefer your solution (and I’m using v1.5.x.x …) over the new confirm e-mail function of Gravity Forms (it isn’t very flexible).

    So, thanks a lot for providing your code, I only spend some time to figure out the [1] entries for “fields” :)

    Regards,
    Jack

    • Dan Harrison April 25, 2011 at 3:36 pm #

      Thanks Jack. Yeah, the array index needs changing based on your form! :)

      Dan

  7. Kausar October 15, 2011 at 10:01 am #

    Hi Dan
    I came to your page after a lot of Google’ing.
    I have a simple question . I have two radio buttons , Yes and No . What i want is when i choose No , an HTML element shows up and says some message. I want at the same time the submit button to get disabled . I simply don’t want to allow any one submit form if they choose “NO”.

    Can This be done using a custom function like you did for email.

    Plz do let me know

    Kausar

    • Dan Harrison October 23, 2011 at 1:59 pm #

      Hi Kausar

      How far have you got with this now?

      Kind Regards
      Dan

  8. Jared October 28, 2011 at 6:53 pm #

    Thanks for posting. Even though I didn’t use this for email validation, I modified it to validate two fields that I needed to be the same for spelling reasons. The only thing you might add is that the validation is based on field position in the form. So I had to change the $form["fields"][1] to $form["fields"][6] and show validation on $form["fields"][7]. Maybe you could do it by id as well? that would be better in case the form ever got rearranged.

    In any case, thanks so much!

Leave a Reply