-
Notifications
You must be signed in to change notification settings - Fork 1.1k
data-match validator not monitoring target field for changes #316
Comments
Hmm, yeah. I'll investigate. |
Hey, great project. I don't wanna be the one to echo "hey I found the same bug", but I was trying to implement a equlasgreater and equalslesser using the same approach of the "match" function and than I realized the same bug then happens to my new functions. So it would be really great to fix the mentioned bug. |
It's a result of the recent change that skips a field's validation if the input hasn't been touched. It needs to be smarter about it. I probably won't have time to fix it very soon. |
I've run into this issue a second time in a different project while creating a custom validator that depends on another field. Decided to take a look into the source code and saw that the cached result check and assignment is done before the validators are run. So what I ended up doing is clearing the cached result at the beginning of my custom validator knowing it will force the validator to run on the next check. The code I added to my validator is as follow:
Hopefully this work around helps some people out. |
Thanks @Jargon64 . I scheduled to take a look at the validator in a month, hope this work, I liked this validator. I'll also share any progress. |
Think I've discovered a bug with the data-match validator. Take the example at http://jsbin.com/hisoha/6/edit?html,js,console,output
If you provide a valid email address in the first field, then retype the same email address in the second the validation works as expected. However, if you then go back to the first email field and enter in a completely different, yet valid, email address the validation still succeeds and the form can be submitted.
I assume this is due to the way the valid state is cached per field for optimisation purposes (after reading through other issues on this board).
The only way I can safely proceed is to put a data-match on both email fields (referencing the other), but then the form starts whining at you before you even get to the confirm email field.
The text was updated successfully, but these errors were encountered: