June 26, 2015: Added support for multi-page form navigation. Thanks @UaMV!
June 23, 2015: Updated to also allow enter on submit buttons. Thanks @UaMV!
I was asked an interesting question on Twitter the other day.
@GravityWiz • Have a snippet or plans for a perk that would prevent submission when users hit the ‘Enter’ key?
— Ua Vandercar (@UaMV) June 19, 2015
@GravityWiz • A few complaints from users who unwittingly try advancing fields w/Enter rather than Tab. Thus, form submits before completed.
— Ua Vandercar (@UaMV) June 19, 2015
It had not occurred to me that some users would attempt to progress through the forms with the “Enter” key rather than tabbing. I think this is one of those cases where it’s hard to remember how new users interact with forms since we’ve been using them so long.
Disabling submission on enter could be quite frustrating for power users so use this with discretion. If you’re form is targeted towards non-technical users, I think you’ll be safe.
'.gform_wrapper',
.Getting Started
- Install our Custom Javascript plugin.
- Click the “Download Code” button above to download the raw version of this snippet.
- Copy and paste the snippet into the editor of the Custom Javascript for Gravity Forms plugin.
- That’s it!
Applying to All Forms
If your theme has a method for including script blocks in the header or footer, you can copy this snippet there.
Otherwise, you’ll need to copy the snippet into an existing script file or create your own. Make sure to remove the