Validating a form using java script

The zip file contains the javascript file, examples.

validating a form using java script-36

Form validation normally used to occur at the server, after the client had entered all the necessary data and then pressed the Submit button.

If the data entered by a client was incorrect or was simply missing, the server would have to send all the data back to the client and request that the form be resubmitted with correct information.

In this example, we are going to validate the name and password.

The name can’t be empty and password can’t be less than 6 characters long. The user will not be forwarded to the next page until given values are correct.

Using client side Java Script is an efficient way to validate the user input in web forms.

When there are many fields in the form, the Java Script validation becomes too complex.(16 printed pages) Introduction Getting Started Writing the Validation Script Connecting the Form to the Script Associating Form Fields with Custom Script Code Listing Conclusion When you create forms, providing form validation is useful to ensure that your customers enter valid and complete data.For example, you may want to ensure that someone inserts a valid e-mail address into a text box, or perhaps you want to ensure that someone fills in certain fields.Microsoft® Office Front Page® 2003 allows you to create some custom validation within the form feature.(For more information on how to create form validation using the Front Page form feature, see About creating forms in Front Page 2003.) However, if the form validation provided in Front Page does not suit your needs or the site on which you are working is hosted on a server that does not have Front Page Server Extensions from Microsoft installed, you may need to create custom form validation.The idea is to create a set of “validation descriptors” associated with each element in a form.