I am using the Validity plugin (http://validity.thatscaptaintoyou.com/) in my Ajax app. Per the documentation, since I am not using a form, I call it as follows:
// This is the validation function:
function validateForm() {
// Start validation:
$.validity.start();
// Validator methods go here:
for(key in fields) {
var nextField = fields[key];
console.log("validating: " + nextField.name);
nextField.validateField();
}
// All of the validator methods have been called:
// End the validation session:
var result = $.validity.end();
console.log("validity result: ");
console.log(result);
// Return whether it's okay to proceed with the Ajax:
return result.valid;
}
the validateField() function in my field object calls Validity function on my inputs like require(), assert(), match(), etc... This works fine the first time it is called - invalid inputs get flagged correctly. However, when it gets called subsequently, all the validation tests pass no matter what. The result object is: Object {errors: 0, valid: true}.
Is there some Validity function I need to call in between calls to validity.start()? (besides calling validity.end())