• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

submit a form when you hit 'enter'

 
Chitra Jay
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How do I make a form submit the values upon hitting enter in the textbox?
In the webpage, there are 2 textfields username & password and a go button (which is a actually an image).
when the user hits 'enter' on the password field, the form should submit values.
Code Snippet:
<form action="/Online/logon.aspx" name="thisForm" id="thisForm" method="post">
<td><img src="pix/user_name.gif" alt="Username" width="49" height="25" border="0"></td>
<td width="80"><input tabindex="1" type="text" name="username" value="" size="10"></td>

<td><img src="pix/password.gif" alt="Password" width="49" height="25" border="0"></td>
<td width="80"><input tabindex="2" type="password" name="password" size="10"></td>

<td width="25"><a href="/Online/logon.aspx" onKlick="document.thisForm.submit(); return false;" tabindex="3">
<td><img src="pix/go.gif" alt="Go" width="25" height="17" border="0"></a></td>
</form>

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I make a form submit the values upon hitting enter in the textbox?


Make sure that the form has a submit button.
 
Nila dhan
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this

<input type="image" value="submit">
 
Chitra Jay
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!! that worked
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic