PDA

View Full Version : Re: Force TAB key in javascript



sridhar412
Jun 17th, 2002, 05:30 PM
I am working on a asp program where input boxes are created dynamically. These input boxes have maximum of just 1 char.
ie. just one char allowed per input box.

I need a script for automatically putting the cursor to next input box on keying some value to input. How can i do this?

sridhar

JohnKrutsch
Jun 17th, 2002, 06:39 PM
Show us how the boxes are written out so we can show you the easiest way to implement it.

sridhar412
Jun 18th, 2002, 03:59 AM
I have used the following code in asp:

<%y=rs1("Word1_Position")%>
for i=1 to len(y)
if mid(y,i,1) = "*" then%>
<input type="text" taborder=<%=i%> name="T1<%=i%>" size="1" maxlength="1" style="border-style: solid; border-color: #FF0000" >

<%else%>
<input type="text" taborder=<%=i%> name="T1<%=i%>" size="1" maxlength="1" style="border-style: solid; border-color: #000000" >
<%end if
next%>

All the inputs of maxlength1. What i want is to move to the next taborder automatically once the current input is filled.

sridhar

JohnKrutsch
Jun 18th, 2002, 05:08 AM
You could try something like this:

<input type="text" taborder=<%=i%> name="T1<%=i%>" onkeyup="document.FormName.T1<%=i+1%>.focus()" size="1" maxlength="1" style="border-style: solid; border-color: #FF0000" >

Be sure to replace FormName with the name of your form.

sridhar412
Jun 18th, 2002, 12:55 PM
Thank you.

sridhar412
Jun 21st, 2002, 02:28 PM
Your suggession works well - as long as TAB / SHIFT+TAB is not used.

When i use Tab, it goes forward twice and shift+tab does not stay at previous tab order- moves to next tab order.

any way to overcome?

sridhar