Javascript Validation script for any type of html forms
Easy to use validation script, with registration forms, login form, guest books, contactus form.
Download the validation script from top of the page. You can check validation against the following:
How to use?
Add in the <head> </head> section
<script language=”Javascript” src=”gen_validatorv1.js” type=”text/javascript”></script>
In the <body> section give the html form any name
<form name="myform">
<input type="text" name="name">
<input type="text" name="email">
.
.
.
.
</form>
//Add the validation
<SCRIPT LANGUAGE="JavaScript">
var myformValidator = new Validator("myform");
myformValidator.addValidation("name","req","Please enter the name");
myformValidator.addValidation("email","req","Please enter the email");
myformValidator.addValidation("email","email","Please enter the valid email");
</SCRIPT>
| req | Field is required |
| maxlength | The maximum length of the field |
| minlength | The minimum length of the field |
| alnum | The field should be have only alphanumeric characters |
| num | The field should be have only numeric characters |
| alpha | The field should be have only alphabetic characters |
| The field should have a valid email address | |
| lt | The field value should be less than |
| gt | The field value should be greater than |
| regexp | Regular expressions |
| dontselect | Dont select |
| dontselectchk | Dont select check |
| selmin | Select minimum |
| selone | Select One |