Solved

automatically move cursor

Posted on 2007-04-04
4
170 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now