Disable HTML5 Validation on Gravity Forms

An easy way to disable HTML5 validation on your Gravity Forms.

Why we created this snippet?

There are a number of reasons why you might be looking for a snippet like this. We wrote the snippet originally after encountering an issue with a form not submitting if a user entered an incorrect email, even after correcting the mistake. There was a conflict between Gravity Forms preventing double submissions and the browser based support of HTML5 validation. Our fix was to disable HTML5 validation and rely on the Gravity Forms validation.

How do I get started?

  1. This will work with even Gravity Forms v1.0 but that’s no excuse not to be running the latest version.
  2. Copy and paste the snippet into your theme’s functions.php file.
  3. Once you have installed the snippet, you’re good to go! This one’s plug and play.

For greater control over the attributes on the form tag, make sure to check out our Gravity Forms Tag Editor plugin.

If you use it and like it, let us know!

Comments

  1. James Simpon
    James Simpon September 28, 2022 at 1:07 am

    Hi, This snippet still valid? as its not working as disabling html5 output in gravity form setting Eg. if we are editing an entry , then the validation prohibiting again. but disabling html5 in settings then its work as expected.

    Reply
    1. Dario Space
      Dario Space Staff September 28, 2022 at 8:46 am

      Hi,

      When testing locally, this seems to be working. If you’re a Gravity Perks customer, drop us a line and we’ll look into it.

      Best,

  2. Chris
    Chris March 25, 2019 at 7:55 pm

    Just wanted to thank you for this post – although we didn’t use this snippet, it did push in the right direction to enabling the “Output HTML5” setting for our form. Much appreciated!

    Reply
  3. Victor Ramirez
    Victor Ramirez May 31, 2018 at 9:23 am

    Is there a benefit using this instead of ‘disable html5 output’ in the Gravity Forms settings?

    Reply
    1. David Smith
      David Smith Staff June 4, 2018 at 11:09 am

      It will have the same effect but disabling HTML5 also disables ALL HTML5 features, not just the HTML5 validation.

  4. Rob
    Rob April 26, 2017 at 5:09 pm

    welp, this broke my site. It wasn’t clear that only part of it needed to be in the functions.php file. I mistakenly added all of it to the existing code. -__-

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.