aspxtreme

Data Entry Validation

Abakada ~ Back to Basics


One of the more important uses of JavaScript is to validate user input prior to sending the data to a receiving program at the server end. This is significant for several reasons:

  • It reduces load on the server. Invalid data are already filtered out when input is passed to the program.
  • The user gets quicker responses, as the validation is performed on the client-side. The data does not have to be sent back for correction.
  • It simplifies the server-based program.

Basically, an author can choose to validate input in two levels:

  1. at the field-level, as the user inputs the data, by assigning a handler to either:
    • the onchange event attribute of each form element that you want validated;
    • any of the keyboard events attribute possible for the given field.
  2. at the form-level, when the user submits the form, by assigning a handler to either:
    • the onclick event attribute of the button that submits the form;
    • the onsubmit event attribute of the form itself.

Example Validation Routines

This section lists the basic set of form validation routines that are covered in this workshop:


See Also

Web Forms Validation



Books and more ...

Contents
Overview
JavaScript Components
JavaScript Basics
Programmimg With JavaScript
Data Entry Validation
 


Suggested Reading



Back to top

Check out related books at Amazon

© 2000-2008 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note