1. Home
  2. Computing & Technology
  3. JavaScript

Text Field and Text Area Validations

A selection of different validation routines that you can put together to validate the text fields and text areas that you have in your forms.
Mandatory Fields
The simplest field validation is to test a text input field to see if something has been entered into it.
Alphabetic and Numeric Validations
Often a field needs to contain only numbers or only words. This tutorial shows you how to test for specific character ranges in the field content.
One and Only One
How to test for one and only one occurrence of a given character in the input.
Adjacent Characters
Sometimes certain characters are not allowed to be next to one another. Other times there must be at least one occurrence of a given character combination.
Only Adjacent
Testing for characters only appearing in fixed combinations is not as easy as the tests we have performed so far. This tutorial shows you how to do it.
Character Order
Validate that one specific character appears in the text before another specific character.
Minimum and Maximum Distance
How to validate that a certain number of characters appear between certain specific ones.
Starting Values
How to validate that the text string that has been enterd starts with one of a set range of values.
Ending Values
How to validate that the text string that has been enterd ends with one of a set range of values.

Explore JavaScript

More from About.com

  1. Home
  2. Computing & Technology
  3. JavaScript
  4. Validating Forms
  5. Text Field Validation

©2008 About.com, a part of The New York Times Company.

All rights reserved.