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. 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.

Email validation :

Check email address as entered by user.

Disable radio button :

Enable or disable period button by using a checkbox.

datalist:

Adding options to a datalist.

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


Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com




    Post your comments , suggestion , error , requirements etc here .




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer