A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
Losing data from submit using the enter key
Marilyn de Queiroz
Joined: Jul 22, 2000
Oct 13, 2004 13:32:00
I have a page that contains a simple form.
<form action="/servlet/MyServlet" method="post"> Password: <input name="password" type="password" size="50"><br><br> <input type="submit" name="action" value="something"> </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
Joined: Nov 08, 2001
Oct 13, 2004 14:57:00
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.
I agree. Here's the link:
subject: Losing data from submit using the enter key
one form, three actions?
To retrieve the value from properties file
hidden and submit input types
My very own MVC framework...
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014