Knockout-Validation
Knockout-Validation copied to clipboard
Validation settings are ignored after applyBindings() is called
I'm using bootstrap with bootstrap modals. I have main viewModel for page itself (applyBindings() on main content DIV element) and another viewModel for my modal window (another call to applyBindings()).
If I apply bindings to modal DIV before I do the same for main page DIV, settings applied to ko.validation.init() are ignored.
BUT it does work if I do any of the following:
- Call
applyBindings()first on the modal and then on the page. - Instead of
applyBindings()I callapplyBindingsToNode()and thenapplyBindingsToDescendants()for modal. - Call
ko.validation.init()before first call toapplyBindings()on the page. - Use
applyBindingsWithValidation()instead ofapplyBindings()for view modal where I need custom validation settings.
Ok now I understand what's actually happening. If applyBindings() is called on any element BEFORE ko.validation.init(), than these settings stop working.