Solved

automatically move cursor

Posted on 2007-04-04
4
173 Views
Last Modified: 2010-04-09
hi guys

I have a field called Judgment number which is a combination of three fields like this

<html:text  style="fieldheight"  property="J_TYPE_CODE" size="4" maxlength="2" />
<html:text  style="fieldheight"  property="J_SEQUENCE_NUMBER" size="15" maxlength="6" />
<html:text  style="fieldheight"  property="J_NUMBER_YEAR" size="4" maxlength="2"/>

When user enters something in the first text box J_TYPE_CODE, i want the cusror to be automatically moved to the next text box
J_SEQUENCE_NUMBER  and then after entering something in the second text box i want the cursor to automatically move
to J_NUMBER_YEAR

i have seen this feature in many websites , any idea how i can do that

thanks
J
0
Comment
Question by:jaggernat
  • 3
4 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 18852924
<html:text  style="fieldheight"  property="J_TYPE_CODE" size="4" maxlength="2" onkeyup="if(this.value.length==this.value.maxLength)this.form['J_SEQUENCE_NUMBER'].focus();" />


<html:text  style="fieldheight"  property="J_SEQUENCE_NUMBER" size="15" maxlength="6" onkeyup="if(this.value.length==this.value.maxLength)this.form['J_NUMBER_YEAR'].focus();" />

... assumes the generated HTML has name properties that match the properties above.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 18852936
sorry, left out the elements array:

<html:text  style="fieldheight"  property="J_TYPE_CODE" size="4" maxlength="2"
onkeyup="if(this.value.length==this.value.maxLength)this.form.elements['J_SEQUENCE_NUMBER'].focus();" />


<html:text  style="fieldheight"  property="J_SEQUENCE_NUMBER" size="15" maxlength="6"
onkeyup="if(this.value.length==this.value.maxLength)this.form.elements['J_NUMBER_YEAR'].focus();" />

0
 
LVL 33

Accepted Solution

by:
knightEknight earned 250 total points
ID: 18852963
DOH!  Still had a typo -- really sorry.  The maxLength property belongs to the field, not the value of the field:


<html:text  style="fieldheight"  property="J_TYPE_CODE" size="4" maxlength="2"
  onkeyup="if(this.value.length==this.maxLength)this.form.elements['J_SEQUENCE_NUMBER'].focus();" />


<html:text  style="fieldheight"  property="J_SEQUENCE_NUMBER" size="15" maxlength="6"
  onkeyup="if(this.value.length==this.maxLength)this.form.elements['J_NUMBER_YEAR'].focus();" />

0
 
LVL 10

Author Comment

by:jaggernat
ID: 18853273
thank you
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question