ericmbarnard/Knockout-Validation — pull request #127 by fazzamar (2012-09-04 22:04:27+00:00)
Title: Adds ability to disable a rule on an observable

Addresses Issue 111 (https://github.com/ericmbarnard/Knockout-Validation/issues/111)

Added enabled property to rules that are added to observables.
Each rule's enabled property is checked before validating in exactly
the same manner as ifOnly. To disable/enable a specific rule on
an observable use the following code...

ko.utils.arrayForEach(myObservable.rules(), function(rule) {
if (rule.rule === "required")
rule.enabled(false);
});

Also added a method to observables with validation named
'setRuleEnabled' with the following arguments...
ruleName: Name of the rule to change the enabled property of. If left
blank all rules will be changed.
isEnabled: Value to set enabled to.

Examples:
myObservable.setRuleEnabled(nothing, false); Sets all rules to disabled
myObservable.setRuleEnabled('required', true); Sets required to enabled
myObservable.setRuleEnabled(); Sets all rules to enabled.