When the parseInputAttributes and writeInputAttributes options are set to true; the writeInputAttributes occurs first; then the parseInputAttributes comes along after and says hey, there's some input attributes that i should go create rules for - even though we already have the rule.
See fiddle for verification:
http://jsfiddle.net/t2y5F/
Suggestion:
Modify addRule() function to check the rule isn't there already. Something like:
addRule: function(observable, rule) {
if (!utils.isValidatable(observable))
observable.extend({ validatable: true });
var hasRule;
ko.utils.arrayForEach(observable.rules(), function(arrRule) {
if (arrRule.name == rule.name) {
hasRule = true;
return;
}
});
if (!hasRule) {
//push a Rule Context to the observables local array of Rule Contexts
observable.rules.push(rule);
}
return observable;
},
When the parseInputAttributes and writeInputAttributes options are set to true; the writeInputAttributes occurs first; then the parseInputAttributes comes along after and says hey, there's some input attributes that i should go create rules for - even though we already have the rule.
See fiddle for verification:
http://jsfiddle.net/t2y5F/
Suggestion:
Modify addRule() function to check the rule isn't there already. Something like: