jQuery validate basistance...
Hi,
We have implemented the great validate class, but are running into some issues...
For backwards compatibility reasons, our form validation is initiated as follows:
- $('form').livequery(function() {
$(this).validate();
$(this).find('.fx-widget').each(function() {
validators = $.parseJSON($(this).attr("data-validation"));
for(i = 0; i < validators.length; i++) {
switch(validators[i]["TYPE"]) {
case 'required':
$(this).rules("add", {
required: true,
messages: {
required: validators[i]["MESSAGE"]
}
});
break;
case 'minlength':
$(this).rules("add", {
minlength: validators[i]["LENGTH"],
messages: {
required: validators[i]["MESSAGE"]
}
});
break;
default:
// do nothing...
}
}
});
});
My only remaining issue is that it shows the correct message in validators[i]["MESSAGE"] for the minimal lenght validator, only if the field is EMPTY; if it is not empty, it shows the validation message from the plugin itself, which now is a bit stupid as it keeps on updating between the message we sent from the backend, and the message in the plugin code...
Is this a known issue?
---
http://www.flexin.be