Navigation Menu
Alphabetical Listing
Site Contents

Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Be a Commerce Partner














Internet.com

IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Developer Channel

FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

General

Automatically sets focus to the next form element when the current form element's maxlength has been reached. The user, then, does not have to manually click in or tab to the next field. Very easy to change for different size fields. Perfectly suited for constant-length strings such as a phone number or social security numbers.


Phone Number :
1 - ( ) - -

Social Security Number :
- -

Notes

  • Created by: Cyanide_7
  • Posted: April 21, 2000

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: autoTab.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

8. From: Bob Vila
To fix the "One Anomaly"
06/03/2008 18:55:22

use:

input.form[(getIndex(input)+1) % input.form.length].select();

instead of

input.form[(getIndex(input)+1) % input.form.length].focus();

9. From: Reg
Can't do much with this one
05/16/2008 18:24:40

when moving to the next field, it does not set the focus to highlight the field, so that anything keyed adds to what is there instead of replacing it. And if that field is already full, you just jump to the next field.

It's a shame because the idea is really worthwhile

10. From: Lee (Admin)
10/31/2008 14:28:25

Well, that's just not the way not was created. It could always be adapted to do that.

6. From: Shabbir
05/02/2008 04:47:50

Hi
I had followed the steps as mentioned but its not reflecting while running on ASP.NET page. Please let me know the reason.

Thanks
Shabbir

7. From: Lee (Admin)
06/26/2008 11:43:42

In order to better help you, you'll need to post your question over on the forums.

4. From: Myduyen
Error on Firefox when using auto tab
04/14/2008 22:28:13

I copied and used your autotab javasript for my form (built with struts 2), but I got this error when running it in Firefox
Exception... "'Permission denied to set property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://localhost:9999/sfp/js/autoTab.js :: autoTab :: line 11" data: no]
[Break on this error] input.form[(getIndex(input)+1) % input.form.length].focus();

How should I fix this error? Thanks!

5. From: Lee (Admin)
06/26/2008 11:36:48

In order to better help you, you'll need to post your question over on the forums.

3. From: Munish
01/23/2008 00:27:44

This javascript really help me & save my time as well!

2. From: Nasir Ali
This function has one anomaly
05/24/2007 09:09:17

This auto tab function has one anomaly that is, when we move into the text field which already has characters with max length, it bypasses that filled text field. then we need to move back to that text field and has to use only backspace tab to clear filled data. otherwise natural behavior is if a text field is filled with characters and reached max length and we move into it by tab then if we press any key the full selected text of that field must be cleared and that key pressed character must be shown.
Is there any solution to this? can we make any change in this function to act and behave logically?
anxiously waiting for your reply.Thanks.
Best regards,
Nasir

1. From: Walter Coole
05/08/2007 19:54:13

Flawed: the user can't use Shift-tab to go back to correct a mis-entered value.


Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.