Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation settings are ignored after applyBindings() is called #638

Open
phobos2077 opened this issue Dec 1, 2016 · 1 comment
Open

Comments

@phobos2077
Copy link

phobos2077 commented Dec 1, 2016

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 call applyBindingsToNode() and then applyBindingsToDescendants() for modal.
  • Call ko.validation.init() before first call to applyBindings() on the page.
  • Use applyBindingsWithValidation() instead of applyBindings() for view modal where I need custom validation settings.
@phobos2077
Copy link
Author

Ok now I understand what's actually happening. If applyBindings() is called on any element BEFORE ko.validation.init(), than these settings stop working.

@phobos2077 phobos2077 changed the title Validation not working with several binding contexts Validation settings are ignored after applyBindings() is called Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant