SQL PHP HTML ASP JavaScript articles and free scripts to download
JavaScript

Javascript Form Validation

We can validate the entry of any form by using JavaScript. This is a client side JavaScript form validation and you can check server side php form validation also. Before taking up any client side validation it is advisable to check JavaScript is not disabled in the client browser.

Demo of Simple Text input validation

Notice how you are prevented from submitting form unless the text input field is filled.


Some of the requirement of validation before allowing form to be submitted is here. These validations are some sample only and actual requirement may change.

Text Box:

Can't be left blank, only text or only numeric data to be entered. There can be an upper limit of data entered in a textbox.

Radio button ( Period button ) :

One of the several radio button to be selected before submitting the form

Checkbox :

User must check before submitting. One or more to be checked.

Listbox ( dropdown box ) :

One of the options has to be selected before submitting.

TextArea :

Can't be left blank or some minimu data to be entered. There can be a restriction on maximum number of text to be entered.
Element / Functions Description
Submit ButtonEnable or Disable submit button of a web form
Reset ButtonResetting button on a form and Resetting the form by getElementById
getElementByIdManaging elements of a form by using getElementById

validation of period button


Google+

Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

Form Validation in JavaScript
Checkbox Validation of a form



HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer