JQuery Validator
Jan 09
Validating a form is always my least favorite thing to do. Call me simple, but I’d much rather eat grass than validate user input. BUT it is inevitable.
That is why I spent a day writing a form validation script that you can just drop in, make a couple changes to your form and have a beautiful client side validation script.
Note: This is client side validation, not server side. YOU STILL NEED TO VALIDATE ALL INPUT ON THE SERVER!
Validation Types
- Required Field
- Date
- Numeric
- Conditional
Sample Usage
<form id="form1" action="/sample.php" onsubmit="jabValidateForm('sample_form')">
<label id="lblEmail" for="txtEmail">Email Address</label>
<input id="txtEmail" type="text" validate="true" vgroup="sample_form" validationType="required email"
errElem="lblEmail" friendlyName="Email Address" />
<input id="btnSubmit" type="submit" value="Submit" />
</form>
When this form is submitted by clicking on “btnSubmit”, jabValidateForm() will loop through the elements that have the attribute “validate” set to “true”. The script first checks to see if the control is required, the will evaluate it against the email validation regular expression.
Requirements
I have not tested this script in any version of JQuery other than version 1.2.9. So as of right now, version 1.2.9 is required.
Another must have is ThickBox. I know it isn’t supported any longer, and there are better light boxes, but this one was my favorite at the time I coded this.
Who is Using It
A few notable websites are using this script, and from my email, I believe a few more will be soon.
- Related Companies (www.related.com)
- The version Related Companies uses is a version I had to modify to fit their light box needs.
- Crimeweb (www.crimeweb.net)
- Not used on their main site, but one of their products ships with a modified version of the Validator.
Download JQuery Validator
This script is provided free of charge, and without warranty. All I ask in return of you using this script is to let your friends and family know, and keep software the way it should be free!


Jeremy, THANK YOU! THis is just what i needed. Using it with asp.net wasn’t exactly as simple as mentioned because i have multiple “forms” even though it is in a single “webform”.
All i had to do though, was declare “var group = ”;” then set the OnClientClick attribute to “group = ‘login’” of the “form” i wanted to validate. THen i registered the onsubmit script to call “jabValidateForm(group).” And done!
Dallas, you are welcome.
I actually developed this for ASP.Net, and did the exact same thing you did. I hope with the lack of documentation, development wasn’t too difficult.
Thank you for your kind words.