Trapping Enter Key

Results 1 to 2 of 2

Thread: Trapping Enter Key

  1. #1
    DKL Guest

    Default Trapping Enter Key

    Hi,<BR><BR>I have 2 text boxes ( userid and password ) and 2 buttons ( Cancel and Logon ). The Logon button calls function validate() in javascript. I&#039;m trying to implement a logic so that when users hit Enter in password field it should call validate() . How to implement this ?<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default Instead of calling validate

    in an on click of the button, make the button a submit then call validate on the onsubmit of the form<BR><BR>all validate does is return true or flase depending on the tests.<BR><BR>&#060;form name="theform" action="test.asp" method="post" onSubmit="return validate();&#062;<BR><BR>then when the user hits enter on any of the fields (except for texarea) the form will attempt to submit running the validate function each time.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts