Really Easy Field Validation - Version 1.5.4
Saturday, January 6, 2007I've uploaded version 1.5.4 of the Really Easy Field Validation library . This version adds a 'validate-selection' validator - to check and see if the selected option on a select element is not the first one. That's the one that usually reads 'Select one...'. Also I've added a bunch of options for custom validators to make it easy to do common validation functions without having to write a function. I've also moved the documentation out of the blog and into a more stable place. The old blog post had gone over the 200 comments mark. Enjoy! [UPDATED!] Oops, left a trailing comma on an array.. 1.5.4.1 is now available, sorry folks.
7 Comments
Thanks! I implemented it right away.
hello its a great script but i have one question that can i use image button for validation reset function if yes plz tell me, Thank you for your great script !!
Sure can, raj,
Just add a call to valid.reset() on the onclick event of the element.
Hi,
Very interesting!
Just read http://www.gregphoto.net/index.php/2006/07/30/ajax-form-validation/#comment-82919
It would be great if your idea and the idea above could be combined to get the best of both worlds:
1) simple class based client-side validations and
2) robust (and possibly complex) server based validations; where all the validations are kept on the server
Cheers,
Zon
Hi, as you know, this validation has a fucntion (validate-date-au) to validate the date format for dd/mm/yyyy, but now, I want a one for the format yyyy=mm-dd, and I have change the code to:
'-------------------------------
['validate-date-cn', 'Sorry, your date format is incorrect, it shoud be YYYY-MM-DD.', function(v) {
if(Validation.get('IsEmpty').test(v)) return true;
var regex = /^(d{4})-(d{2})-(d{2})$/;
if(!regex.test(v)) return false;
var d = new Date(v.replace(regex, '$2/$1/$3'));
return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) &&
(parseInt(RegExp.$1, 10) == d.getDate()) &&
(parseInt(RegExp.$3, 10) == d.getFullYear() );
}],
'-------------------------------
but it doesn't work, can you help me to correct my code? thank you very much......
I got it, don't worry
dont' work with prototype 1.6+, :(