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

ko validation with ko 3.4.0 and ko.options.deferUpdates = true; #635

Open
jorgevinagre opened this issue Nov 2, 2016 · 1 comment
Open

Comments

@jorgevinagre
Copy link

Hi there

The sample at http://jsfiddle.net/KHFn8/5424/ doesn´t work as expected when ko deferred updates are set globally.

I´ve tried this:

  1. Fill one of the mandatory fields
  2. Click submit
  3. Click reset
  4. All error messages disappear and the validation message for the filed at number 1 appears

Is this a bug on ko validation?

Thanks

@ricardobrandao
Copy link

ricardobrandao commented Feb 22, 2017

Actually this is because of knockout deferring updates until it needs to render. In this case, it seems that showAllMessages run before the updates on the observables are done. Not sure who's fault it is and what's the expected behaviour though...

I've updated you example with a non working version and a working version.

As a quick fix, you can make your example work by running ko.tasks.runEarly(); just before resetting the validation (i.e. showAllMessages(false);).

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

2 participants