I'm having a problem. Up till' now, I was using my own jQuery build to do this. Meanwhile, I was told to change it to jQuery validation plugin. It was working before but now I've been stuck in trying to make the action of the command execute and rerender (it doesn't even rerender at the moment). The field validation work fine, just the submit is messing me all up. I'd appreciate any help or advice you could give.
function validateForm(id,e){
var form = jQuery('[id$='+id+']');
form.validate();
jQuery('[id$=name]').rules("add",{
required: true,
minlength: 5
});
jQuery('[class$=costPercentage]').rules("add",{
required: true,
number: true
});
jQuery.validator.messages.required = "You better have entered a value.. or else!";
jQuery.validator.messages.equalTo = "No silly, you're supposed to type the same set of characters AGAIN.";
if(!form.valid()){
e.preventDefault();
return false;
}
return true;
}
<apex:commandButton value="Save" onclick="return validateForm('SomeId',event);" action="{!createFunction}" rerender="SomeForm"/>