• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hidden and submit input types

 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
< 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"?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have multiple textfeilds on the page?

Eric
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it looks like this:
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm aware that having multiple inputs on a page may prevent the enter key from working as described.
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An interesting (to me) caveat is that hitting "enter" works in Firefox, but not in IE6
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"?
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic