Terranet Technologies  Welcome to TNet   Sign Up  Login 
           
HomeDevelopmentConsultingSolutionsUsersSupport
zip:
Weather in Tulsa, OK (74133)
Current Conditions:
Fair 77°F
Fair
Wind: CALM calm mph
SAT
9/4
Sunny
H:85
L:55
SUN
9/5
Sunny
H:89
L:64
MON
9/6
Sunny / Wind
H:93
L:69
TUE
9/7
Scattered T-Storms
H:87
L:68

Last Update: 4:55:03 PM
weather.com

Services
ASP.Net
C#
VB
TSQL
   

Welcome to Terranet Technologies forum.  This is a private Web Service so it will require you to create a seperate account other than your Terranet account.   Please use your existing Terranet user name.  It will only require your email and a password to join.

Join | Logon
 All Threads | New ThreadView:  Search:  
 Author  Thread: ASP.Net and javascript tabbing
sharpcoder
Posts: 2
ASP.Net and javascript tabbing
Posted: 18 Mar 07 9:18 AM
Hello all,

I am looking for a way in my asp.net 2.0 application to auto tab when typing in things like phone number and just automatically going to the next required field.
[Reply][Quote]
kroesch
Posts: 10
Re: ASP.Net and javascript tabbing
Posted: 18 Mar 07 10:56 AM
First put this script in the <head> section

<script>
function autoTab(element, nextElement) {
if (element.value.length == element.maxLength && nextElement != null) {
element.form.elements[nextElement].focus();
}
}
</script>

Next add the following keyup command in your textbox html:

<asp:TextBox ID="txtPt1" runat="server" MaxLength="3" onkeyup="autoTab(this,'txtPt2');" Width="27px">
<asp:TextBox ID="txtPt2" runat="server" MaxLength="3" onkeyup="autoTab(this,'txtPt3');" Width="27px">
<asp:TextBox ID="txtPt3" runat="server" MaxLength="4" onkeyup="autoTab(this,'txtPt1');" Width="39px">

The above html work as: When your enter your area code (txtPt1) it will auto tab the next textbox txtPt2. when you enter the prefix it will auto tab to the the last txtPt3. After entering the 4 digit number it will go back to the first text box txtPt1.

In ASP.Net 2.0 it will tell you that onkeyup is not valid for asp:textbox but it still will work.

Any questions let me know.

[Reply][Quote]
 Page 1 of 1 

Copyright© 1998 - 2010 Terranet Technologies LLC All rights reserved.