• Resolved wcsmith

    (@wcsmith)


    is there a way to keep formidable forms from submitting when the return key is pressed on an html input vice pressing the submit button.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Njones35

    (@njones35)

    Hi there,

    Thanks for contacting us about this. Formidable allows the enter key to submit forms, so what you’re seeing is expected behavior. If you’d like to stop that, you could use custom code. While support doesn’t cover guidance on custom code, I’d be happy to share some ideas about how to approach this.

    The first code in the accepted answer in this stack overflow article looks good for this.

    https://stackoverflow.com/questions/895171/prevent-users-from-submitting-a-form-by-hitting-enter

    You can put the code in your Theme’s footer section or the “After Fields” section of your Form Settings → “Customize HTML” tab. There are also plugins and some page builders that allow you to add JavaScript to a page.

    In a quick test, it looks like this works for me. I needed to swap the $ for jQuery in in two places. Also, you need to surround the code with script tags.

    You can see how we surround code with script tags in our JavaScript examples, like this one:

    https://formidableforms.com/knowledgebase/javascript-examples/#kb-trigger-conditional-logic-when-typing

    Best,

    Nathanael

    Thread Starter wcsmith

    (@wcsmith)

    Great. Thanks. I had code similar to the stackoverflow article, but I guess I did not realize I had left out the event.preventDefault() statement. With that statement, it works just fine.

    Thanks for your help.

    Warren

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Formidable form and return key’ is closed to new replies.