Knockout-Contrib / Knockout-Contrib/Knockout-Validation
Validation settings are ignored after applyBindings() is called
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 366
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
Research direction
Reproduce the issue with separate modal and page view models, calling applyBindings() in the reported orders and applying ko.validation.init() at different points. Start by tracing the applyBindings and validation initialization entry points; done means custom validation settings remain effective regardless of which view is bound first.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100