Skip to main content
Inspiring
November 23, 2009
Question

Submit button and Enter button

  • November 23, 2009
  • 2 replies
  • 4074 views

All of my forms have a submit button to process the page. However, a user filled out the form and hit the enter key on the keyboard instead of the submit button on the form,and nothing happened.

Needless to say, he complained,and now the boss said that all enter buttons on the keyboard should function the same as the submit button on the page.

I dont think I have ever done this before. Does this require javascript code to make both function the same, or is there anohter method ?

This topic has been closed for replies.

2 replies

Inspiring
November 23, 2009

Ian's answer is not quite complete.  If the focus is in a dropdown, the enter key will not submit the form.  The OP can determine the relevance.

ilssac
Inspiring
November 23, 2009

Unfortunately the Normal behavior for most browsers is that the enter key will submit a form.

If your form does not do this, you have done something to circumvent the normal browser behavior and that is what would need to be addressed.

Do you have any JavaScript already in play on this form or page?  Is this a basic HTML form or some type of Flash or Ajax form?

trojnfnAuthor
Inspiring
November 23, 2009

It is just a basic htlm/coldfusion form.

There is already some javascript code to validate the entries when the form is submitted using the submit button.

Also, the form submits to itself instead of an action page.

With that said, is the existing javascript codes overriding the enter button on the keyboard ?

Someone told me there was a quick fix with some minor javascript code, but I do not want to go to each page and apply the code. So if the existing enter button on the keyboard already functions as a submit button, then that would be great, just need to figure out why it is not working.