-
Notifications
You must be signed in to change notification settings - Fork 334
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
callback validation not working when have default value #42
Comments
Hello, |
@tongyi121 I'm afraid this is deliberate. Because validation needs to be instant, and your callback might take a while to respond (say you might be doing your own AJAX and the server goes down), the validator assumes the field is valid until it knows otherwise. When it gets a response, it re-runs the validation, but by then it might be too late. Because you're setting the default value (in the HTML?), no events are triggered. This means the first time the validator checks the value is when 'submit' is clicked. I'd suggest using the Apologies for the badly worded documentation, I'm in the process of re-writing it. |
If the above doesn't help, feel free to re-open and add more information. Thanks |
Hi. I'm having a similar issue using the callback (I'm using it to validate the date field). I am using placeholder and have made the field required- and the validation is correct when no input is given. If I type in an incorrect date, the callback is called and the error message shows. However, if I simply 'submit' the form at that point, the form submits with the bad date info. Am I using callback correctly? Is there any significance to the fact that the error message/label is "amber" after failing invalidation and not "red"? After I submit the message/label becomes "red". |
I set a wrong defalut value,submit form immediately,then validation is not working.
The text was updated successfully, but these errors were encountered: