| Author |
hidden and submit input types
|
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
< input type='hidden' name='action' value='Log in' > < input type='submit' name='submit' value='Log in' > When I use the above, I can hit the enter button and my form will be submitted. However, when I try to combine the two, i.e. < input type='submit' name='action' value='Log in' > I can only submit the form when I hit the submit button. Is there something magical about the name being "submit"?
|
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Do you have multiple textfeilds on the page? Eric
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
No, it looks like this:
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
|
I'm aware that having multiple inputs on a page may prevent the enter key from working as described.
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
|
An interesting (to me) caveat is that hitting "enter" works in Firefox, but not in IE6
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
Originally posted by Marilyn de Queiroz: An interesting (to me) caveat is that hitting "enter" works in Firefox, but not in IE6
Does IE6 submit on "enter" if you name the submit button as "submit"?
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
If I rewrite the html as < input type='hidden' name='action' value='Log in'> < input type='submit' name='submit' value='Log in'> then I can either hit the "submit" button on the web page or hit the "enter" button on the keyboard and it takes me to the next page. This works in both Firefox and IE6. [ May 14, 2006: Message edited by: Marilyn de Queiroz ]
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
|
If I understand this page correctly, people are more worried about submitting something before it's ready, so the default action is to submit without the name-value pair when you hit "enter". By adding the extra line, the info is in the page rather than in the submit button, and thus gets submitted.
|
 |
 |
|
|
subject: hidden and submit input types
|
|
|