JavaScript form validation

Form validation is the process to ensure that user has entered the mandatory fields in a form. The main reason for validation is to avoid the unnecessary load to the web server.
javascript validation
Click image to view Larger
For e.g., Imagine you have a log in form. Without entering the values and user clicking the login button, if you didn’t validated it means the request will send to web server. After checking this value with back end it will throw you an error. This is the unnecessary load for the web server.

To avoid that and also to make sure that user entered all the mandatory fields for your future reference we have to make the form validation.

Below I will explain you a simple form validation using JavaScript. You can view demo and download the example file below.

Download FileDemo

Here is the HTML page

html script

Now the JavaScript for above form


This is the most common method of form validation. Now a day’s Jquery and Ajax form validation is becoming more popular. Soon I will post an article Jquery CSS form validation system.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>