Reputation: 13012
I'm using ko.validation and, previously, I was using it to validate an entire view model at a time. Now, I am splitting the view model up into pieces and I need to be able to validate one or a couple properties at a time. I have several custom validators, so I'd rather not just switch to completely manual validation. Is there a way to use ko.validation to validate just one property at a time?
Upvotes: 1
Views: 369
Reputation: 67
This is an increasingly common issue with view models that need to be re-used in multiple views, or when one view requires multiple instances of the same view model, but with differing validation requirements (references in comments). Knockout and Knockout-Validation are pretty awesome, but the current implementations do not yet scale well to these reusability scenarios.
My recently-open-sourced project 'ValidatedViewModel' developed while working for Extreme Engineeering Solutions provides a means to structure the application of validation constraint groups on an instance-basis. Clone Validated View Model here on github. Please let me know what you think of the documentation, unit tests, and functionality.
Upvotes: 1