p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: how to override enter

Message #1 by bharath reddy <bharath_reddy@u...> on 12 Sep 00 00:38:45 MDT
  My problem is... 

          is there a methos to find out which element or field in the for
m is
generating the event when we submit the form.for eg. i have ten fields wh
are 10 text fields to enter the answers to the questions.i want to know w
field i am in when the enter is pressed and send to the event handler so 
i can send the control or focus to the next field.Now i am capturing the 
and if enter is pressed it stays in the same field.

<%the event handler%>
function checkEnter(evt){
var theKey
if (isNav){
        theKey =3D evt.which
        theKey =3D window.event.keyCode
        if (theKey=3D=3D13){
           return false;

return false if the key pressed is enter from the function.
so if the enter is pressed it stays in the same field
 <form method=3D"post" action=3D"quiz.asp"  name=3D"foQuiz" onkeypress   
  =3D "return
<input type=3D"text" name=3D"userans<%=3Di%>" >

i tried to put the  [onkeypress=3D "return checkEnter(event);"] in the te
fields but no use.

i know it is script problem but if some body would have faced this proble
please help me.


  Return to Index