Custom Rules - matthewnitschke/Kavie GitHub Wiki
Custom rules are added as follows
Kavie.validatorFunctions.isYea = {
validator: function(propVal, eleVal){
// propVal is the value passed in from the ko.extend()
// eleVal is the value being passed in from the observable
if (eleVal == "Yea"){
return true;
} else {
return false
}
},
// an (optional) message that can be displayed to the user if validation fails
message: "Your text is not isYea {propVal}"
}
All Kavie validatorFunctions are top down when it comes to priority. Meaning validator functions added before others will have their messages displayed first
See Async Validation for how to make custom async validation methods
Note: validators cannot be named "section"