The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Disable Enter Key

Labels

This Discussion is public

Notifications

I searched for how to disable the enter key and did not find a definitive answer. I finally settled on a rather simple solution. If you agree it works and is safe to use I suggest you add it to https://formidableforms.com/knowledgebase/javascript-examples/.  I'm using it so it it is flawed please let me know and save me from myself!

Disable Enter Key: Accidentally hitting enter in the middle of a form submits the form and  can generate a bunch of errors.  To disable the enter key on a form go to:

Dashboard > Formidable > Forms (pick a form) > Settings > Customize HTML > After Fields: and add this code:

<script type="text/javascript">

function stopRKey(evt) {

var evt = (evt) ? evt : ((event) ? event : null);

var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}

}

document.onkeypress = stopRKey;

</script>

We don't support overriding default browser behavior. Use at your own risk. That said, a Formidable form works the same as any other.

Discussion closed.