Web Form: Automatically move the focus to next control
Posted on 2003-11-23
Part of my web form contains three textbox server controls into which the user enters a U.S. telephone number. The first textbox is for the 3-digit area code (tbAreaCode), the second textbox holds the 3-digit exchange (tbExchange), and the third textbox holds the last 4 digits of the phone number (tbNumber). So the three controls on the form are arranged to look something like this:
Phone Number: ( _ _ _ ) _ _ _ - _ _ _ _
I have set the MaxLength for each text box to either 3 or 4 to limit input to the appropriate number of digits. Once they type the last digit in a text box I want the focus to immediately move to the next textbox in the tab order.