WillMaster Possibillites Logo EzineSeek Award
Form Field Jump
by
Mari Bontrager

Permission is granted to reprint this article in its entirety, provided no reprints are sent in conjunction with unsolicited bulk email, provided no fee or other value is exchanged, provided no changes are made to the article, and provided the author's name, signature lines, and copyright line are printed with the article; except you may change the article's title.

If your forms have a maximum number of characters you can be kind to the user by placing the cursor to the next field once that maximum has been reached.

Example uses:

  1. Credit card numbers.

  2. Credit card expiration dates.

  3. Telephone number (size would vary by region).

  4. Social Security Number (USA citizens' ID number).

  5. State/Province abbreviations.

  6. Birth dates.

To accomplish it, use the JavaScript onKeyUp() function.

When the onKeyUp() function is used as an attribute in a form field tag, the function runs every time a key is released after being pressed. Example:

<input type="text" name="year" size="4" onKeyUp="_____">

Replace the underscore with JavaScript code to:

  • Check the length of the text already in the form field.

  • Put the next form field into focus, if appropriate.

Line length restraints prohibit the JavaScript code from being embedded in this article. A demonstration page is at http://willmaster.com/a/13/pl.pl?art135demo

The page demonstrates the first four of the example uses listed at the beginning of this article. Simply view the source code of the page and copy the instructions with the example. All of the JavaScript code is within HTML form tags.

Now, if your forms have a maximum number of characters you can be kind to the user by placing the cursor to the next field once that maximum has been reached.

By: Will Bontrager

Copyright 2002 Bontrager Connection, LLC
http://willmaster.com/possibilities/
subscribe-possibilities@willmaster.com