2009-10-18

TrustButVerify - simple jQuery validation powered by LiveValidation

I really like the way LiveValidation runs; however, I REALLY LOVE jQuery selectors & chaining. Unfortunately the LiveValidation approach to validation doesn't feel right when looking at a lot of field-specific validators surrounded by super terse jQuery syntax.

So I decided to make a small 79-line wrapper-type of plugin that is powered by LiveValidation but comes with all the power of jQuery's selectors, chaining and... well, jQuery.

I called the plugin, TrustButVerify. Check it out & let me know your thoughts or if there is room for improvement (which there definitely is).

I have NOT exposed all of the LiveValidation methods; just the ones I found useful & necessary :-p

Here's a sample of some validation:


$(document).ready(function(){
$('#form .required').required();
$('#email').validEmail();
$('#zip').matches(/^\d{5}$/);
$('input.address').required().validate(someCustomFunction, 'your address is out of our area ');
});

1 comment:

tingting said...
This comment has been removed by a blog administrator.