View Full Version : auto tab using core javascript - No HTML
plymakr88
03-26-2003, 05:27 PM
I have a forms designer for a workflow product that uses javascript. I'm trying to figure out how to cause an auto tab to another text box. For example, I have two text boxes to enter in a phone number. The first text box is for the area code and the second for the number itself. When they type in the 3 digit area code in the first box, I want the cursor to automatically tab over to the second box. How do you accomplish this using the core javascript language? This is not a webpage, it's a forms designer using javascript. I've been pulling my hair out trying to figure this one out! Any help would be appreciated. Thanks.
brothercake
03-26-2003, 05:34 PM
With focus:
ref_to_textbox.focus()
beetle
03-26-2003, 05:43 PM
Also see this
http://www.codingforums.com/showthread.php?s=&threadid=13490
plymakr88
03-26-2003, 05:44 PM
I know how to set the focus to the next text box, but I don't know how to detect when the third digit is entered into first text box, which then would cause the auto tab to take place. I've seen example on how to do this with the onKeyup function, but it only works for webpages. I need to know how to do this using the core javascript language. Thanks!
beetle
03-26-2003, 05:49 PM
Javascript is an event driven scripting langauge. Regardless of using it in a non-web environment, there has to be some type of event to trigger the function.
Your 'forms designer' should have it's own object model with specific events as part of that object model.
plymakr88
03-26-2003, 05:53 PM
The only functions for the text boxes in this forms designer are FocusGained and FocusLost. I don't see a function for when keys are pressed within the text box, or changes in the text box. That is why I'm trying to use javascript itself to do it manually if it's possible.
beetle
03-26-2003, 06:23 PM
What about properties of the text-boxes? like value or length? Is there a web-page that has the object model for your forms designer that I could look at?
plymakr88
03-26-2003, 06:30 PM
There's no web page that I know of that has that available. I know how to access the properties such as length and value, but I don't know how to do a onKeyup function that you can do in a webpage.
beetle
03-26-2003, 06:34 PM
Well, without events, you'd need some sort of looping process to constantly read the the textboxes and properly assign focus.
There's got to be events you can utilize. I mean, even without some type of onload event even the script I speak of above wouldn't execute.
Are you getting my point?
If this form designer thing has no events, how are your scripts initiated?
plymakr88
03-26-2003, 06:39 PM
There is an event call FocusedGained. I thought about a Do loop when the text box gets focus, that wouldn't exit until a variable or counter equaled the max length of the first text cell. I just can't seem to get that to work. Any ideas on that?
P.S. I appreciate the help! :thumbsup:
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.