Friday, 2 September 2011

php tutorials: easy jquery form validator absolute message box

Hey all, I was looking for nice and easy form validator in javascript/ jQuery which displays the error messages as absolute div and not block div. Because the most of validators displays messages next to input element or below them.

The issue with such validators is, some time it becomes very difficult to manage the ui when large no of input elements are there on page and proper space is not there on page. It also makes issues across browsers.

Solution is : Display absolute error messages.
I found a great great jQuery plug in : download from here

This is really very nice form validator in jquery which displays error messages in absolute div. With all best features and customization included.


Here are some custom functions for this plug in.

Allow all ASCII characters with regular expression. - javascript

function checkAsciiValues(field, rules, i, options){

var value = field.val();
var length = value.length;

for(var i = 0; i< length; i++){ if(value.charCodeAt(i) < 1 || value.charCodeAt(i) > 255){
return "* Please enter only ASCII values.";
}
}
}

____________________________________________________________________

No comments:

Post a Comment