Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Leaving textbox control
Message
 
 
To
31/07/2003 13:54:35
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00813238
Message ID:
00815689
Views:
9
You understood exactly what I was/am trying to do. I want to create a custom control for user to enter a date. The control will consists of three textboxes (for month, date, and year) and two labels. And, as you understood, I want the focus to move on as the user types month/date.

I will try your code, it looks like it should work. Thank you very much for your help.

>::Is it possible make asp.net form work somewhat like a VFP form where once user enters the text in a textbox (specified in Columns property) the focus goes to the next textbox? That is, without user having to mouse click or tab out of the textbox.
>
>I am assuming your are referring to an example where you have three input boxes for a social security number and when they enter the last digit in each input box you want the focus to automatically jump to the next box?
>
>If this is the case then you can use JavaScript to do this. An example follows:
>
>
><script language="JavaScript">
>  function oFocus(){
>    if(len(this.myform.s1.value) == 3)
>      {
>         this.myform.s2.focus();
>      }
>  }
>
>  function oFocus1(){
>    if(len(this.myform.s2.value) == 2)
>      {
>         this.myform.s3.focus();
>      }
>  }
></script>
>
>
><body>
>  <form id="myform">
>     <asp:input onchange="javascript:cFocus()" type="textbox" id="s1" maxlength=3 />
>     <asp:input onchange="javascript:cFocus1()" type="textbox" id="s2" maxlength=2 />
>     <asp:input type="textbox" id="s3" maxlength=4 />
>
>  </form>
></body>
>
>
>You can optimize the script some more but you get the general idea. I hope my syntax is correct!
>
>HTH
>
>WEs
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform