I have the jQuery Validation plugin:
//name validation
cnForm.validate({
rules: {
customerName: {
required: true,
minlength: 3
},
date: {
required: true,
dateRegex: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d$/,
maxlength: 10
}
},
onkeyup: false,
onclick: false,
onfocusout: false,
messages: {
customerName: {
required: "Unable to proceed, search field is empty"
},
date: {
required: "Unable to proceed, search field is empty"
}
},
errorPlacement: function(error, element) {
var trigger = element.next('.ui-datepicker-trigger');
error.insertAfter(trigger.length > 0 ? trigger : element);
}
});
Whenever I input data that causes an error, I get the appropriate new label to display after the input box/button, but the class error
is also applied to the input box. Is there a way to avoid assigning that class to the box? Thanks.