-
Notifications
You must be signed in to change notification settings - Fork 377
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
async Validation doesn't support caching of responses #341
Comments
Caching seems to work if you invoke the "cached callback" with a zero-timeout: |
Hi I had the same issue where my validation callback would occur immediately if certain data was already cached. The reason is because "validateObservable" in the knockout-validation source code sets the current "valid" value to true after the async call returns (it expects the async call to return some time later, and set the value correctly then). Your linked fiddler fixes the issue, but it could be included in the knockout-validation source code. Have you issued a pull request to that effect? |
The fix for this seems pretty straightforward. Updated fiddle http://jsfiddle.net/mk9bxnLr/ |
I'd love to make a PR. Just need time to fork. Probably be done within 24hr. |
No need to rush. This is for the 2.1.0 release. Consider writing some unit tests too. If you need any help just leave a comment here. Thanks. |
async validation seems to have problems when a caching mechanism is implemented in the validation handler (use case: prevent unnecessary server requests for repeated inputs). the validation message isn't shown when the remote validation message comes from the cache and not from the async request.
demo:
http://jsfiddle.net/fbuchinger/KVxNN/6/
The text was updated successfully, but these errors were encountered: