-
Notifications
You must be signed in to change notification settings - Fork 531
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
validateAfterLeaveOrPressedEnter? #309
Comments
Perhaps there is a way for vfg to integrate https://lodash.com/docs#debounce for text inputs ? |
You should integrate debounce to your async validator. |
@icebob thanks for that suggestion. The examples I had seen with debouncer were trying to control data, but using it to just control the validation should work. |
@icebob having some success, but not quite with _debounce(). Now the error message does not get reported until after I start typing a second time. Is the _debounce() promise not quite what you expected or am I doing something not right?
After typing 123456, I hit a breakpoint in my debounce callback, and it returns [error_message] However, I don't see the error message until I start typing again (e.g. "22") |
Not sure it matters, but the first time I type 123456, my onValidated() gets called 6 times with isValid set to true.
Then the next time I type "2", I get two onValidated calls, the first one isValid is true, the last one is false. |
Would be good a jsFiddle with this issue in order to we can investigate it. |
@icebob here's a jsFiddle to reproduce the issue |
Great, thanks! |
Thanks, @icebob Also wanted to report that sometimes I still get multiple errors: |
That's really needed. Now typing every char will start validation and UI freeze for some time if typing word fast |
Hi @ericpyle, |
I started to add debouncing to vfg in validation process. I think it will solve your problem. |
@icebob yes that seems to work just fine and I no longer see multiple errors being reported. how do you recommend I get a version of vfg with the fix? |
This week I will make a new release. |
@icebob thanks |
Released in v2.1.1 |
I'm a little confused by the current field validation options.
There is validateAfterLoad, and validateAfterChanged (as user types).
How can I validate a field only after a user leaves the control or presses enter (which I believe is the typical way that field validators work?) I don't really want to bother the user that what they are typing is invalid until they are finished typing it and ready to move on.
Thanks for any help!
The text was updated successfully, but these errors were encountered: