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
Knockout-validation doesn't show error message with 'textInput' binding #451
Comments
Confirmed, I'm seeing this with knockout 3.2 as well. Surpisingly, the span elements are sometimes created, but in the wrong place. (In one case, three s later, after a select, instead of on the textInput it should have been attached to) Switching from textInput to value immediately makes the validation start working as expected. The fiddle referred to from the homepage, http://jsfiddle.net/KHFn8/2971/ is an easy way of testing out the breakage |
This seems to work if you add an entry for "textInput" to the section starting at line 962 as shown below. // override for KO's default 'value' and 'checked' bindings
kv.makeBindingHandlerValidatable("value");
kv.makeBindingHandlerValidatable("checked");
kv.makeBindingHandlerValidatable("textInput"); I did not test this very extensively.However, it immediately fixed the issue for me. Looking at the definition of |
@karlp @waynebloss a test for this is available in this commit. |
I can see this issue still happening |
This link doesn't work https://github.com/Knockout-Contrib/Knockout-Validation/blob/master/Dist/knockout.validation.js#L962 Please, can you tell me how can I fix this issue? Thanks in advance. |
I updated the link to point to the source code that existed at the time of my comment in October of 2014. Here is the new link to Line 962 of Dist/knockout.validation.js which shows you the section where you can add However, this workaround only works for that version of the code. If you're using a newer version of Knockout, then I'm not sure what the problem is - I'm not using Knockout at this time. |
It looks like the workaround was merged into Knockout by crissdev, which you can see in the 2 comments on October 31, 2014 and November 4, 2014. The best thing to do in this case is to reproduce the problem using a tool like jsfiddle.net and then post a link to your reproduction in a new issue for the current version of Knockout that you're using. |
The textInput binding has been added in the latest version of knockout.js. However when using it with knockout-validation, the validation rules do apply but the validation message(s) is not displayed in UI when invalid. In fact the span with validationMessage class is missing completely in DOM for the element where textInput binding is used.
The text was updated successfully, but these errors were encountered: