We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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.validatedObservable({ property1: ko.observable().extend({ required: false }) }).isValid()
You would expect true but isValid incorrectly reports falseish value undefined.
In other words, if your initial validated obvservable is correct, isValid will incorrectly keep reporting as NOT valid.
Proposed solution:
ko.validatedObservable = function (initialValue) { if (!kv.utils.isObject(initialValue)) { return ko.observable(initialValue).extend({ validatable: true }); } var obsv = ko.observable(initialValue); obsv.errors = kv.group(initialValue); obsv.isValid = ko.observable(initialValue.isValid()); //pass initial value obsv.errors.subscribe(function (errors) { obsv.isValid(errors.length === 0); }); return obsv; };
Should I create a fork for it? Should I add a test case somewhere?
The text was updated successfully, but these errors were encountered:
Hi @lucasmaj, thanks for that. If you create a new PR with a fix & test case then I'll get it merged into the main branch
Sorry, something went wrong.
Done here: #393
Fixed by #393
No branches or pull requests
You would expect true but isValid incorrectly reports falseish value undefined.
In other words, if your initial validated obvservable is correct, isValid will incorrectly keep reporting as NOT valid.
Proposed solution:
Should I create a fork for it? Should I add a test case somewhere?
The text was updated successfully, but these errors were encountered: