This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Losing data from submit using the enter key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Losing data from submit using the enter key" Watch "Losing data from submit using the enter key" New topic

Losing data from submit using the enter key

Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9056
I have a page that contains a simple form.

When I click on the submit button, all goes as planned, and when I call getParameter("action"), I get "something".

However, when I hit the enter key instead of clicking on the submit button, the form is submitted but the parameter "action" is "null".

What is the best way to handle this problem?

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
The reason why the value of the button is not getting passed is due to the fact that it was not in the reason why it was sumbmitted, the button was equlivilant of sitting there disabled.

Way to get around it, not sure off the top of my head!

People have used hidden fields to pass the value, but that might not be he right solution.

Have you checked out Aspose?
subject: Losing data from submit using the enter key
jQuery in Action, 3rd edition