Well, yes, validators quit when observables change. But ... you can trick using OnlyIf Option validators. I made a sample of Fiddler how it could work.
The question is more ... what do you want to do after the user clicks the first time ....
Basically, the sample sets the onlyIf condition for all validators and checks validateNow, decides when the validators should evaluate ... whatever ... in the submit method.
self.validateNow = ko.observable(false);
onlyIf gets the score on all validators:
self.firstName = ko.observable().extend({ minLength: { message:"minlength", params: 2, onlyIf: function() { return self.validateNow(); } },
and validateNow is only set to submit
self.submit = function() { self.validateNow(true);
... I also increased the data binding a bit, because your sample only puts a red frame on the inputs.
I use to create my closures with constructors. So the sample is not the same "architecure" as yours, but I think you will pick it up.
source share