Viewing 4 replies - 1 through 4 (of 4 total)
  • This can be accomplished via JS:

    $('#form_id_here').bind("keyup keypress", function(e) {
      var code = e.keyCode || e.which;
      if (code == 13) {
        e.preventDefault();
        return false;
      }
    });

    Replace the #form_id_here with the appropriate form ID, or simply use “form” to disable submit on ALL forms via the enter key.

    Thread Starter Gaz

    (@gary04gmailcom)

    Thanks Rob.Unfortunately I am a noob so no idea where to put this code. Can you enlighten me.

    cheers

    It will need to go into your templates javascript (JS) files.

    It also requires some knowledge of Javascript.

    Thread Starter Gaz

    (@gary04gmailcom)

    Thanks Rob.

    Found another way…

    If you just add <body onkeydown = "return (event.keyCode!=13)">

    to the end of one of the text fields on the contact form it disables the enter key action.

    not sure if it will break anything else but seems to be working.

    Thanks for your help.

    G

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Do not submit form with enter key…’ is closed to new replies.