• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use the enter key to link

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have jsp page called login.jsp where the user can input his userID and Password and a signIn link is given.The user can move the cursor from userId to password by using the tab key and user can also move to the signIn link by using the tab key and then user have to use the enter key to go to the next page.But my problem is if i enter the password after entered the userid and do not use tab key instead use the enter key the control is not going to the signIn link.

Please help me to solve the problem.
The part of code that i have used in jsp page is given below:

<tr class="whitebg">
<td height="25" valign="middle" ><a href="javaScript:goTologinAction()" class="btnlink">Sign in </a></td>

</tr>

Thanks and regards
sanjeev
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sanjeev,
You really have a form on that page even though you are using a link for the submission. You can add onSubmit to the form's action and have it call the JavaScript function.
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the password text box, on the event onkeypress, call a method to check wat key has been pressed, and if the key code is 13, you kknow that the enter key is pressed, and then you perform watever action you want.

The sample code,

function enterPressed(){

if (window.event.keyCode==13){
var textValue=document.forms[0].password.value;
validate(textValue)

}else
{
return false;
}

}

html:text name="xyzeeform" property="password"
styleClass="medium" maxlength="18" ON KEY PRESS="enterPressed()"
 
reply
    Bookmark Topic Watch Topic
  • New Topic