-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Yup resolver failing to validate one field dependent on another #27
Comments
Hey @Mathius17 i have check your code and i found some issue and misunderstood of how yup work when you want to check two values.
I suggest you an alternative to your code here -> https://codesandbox.io/s/infallible-panini-uz2ri?file=/src/App.js |
Thank you very much @Vandell63! I definitely like your approach way more and now I have a better understanding of how to check two fields dependent on each other in Yup. One last question just to make sure we're on the same page. The issue still remains, right? Although is a problem with Yup itself. |
No sorry, your issue is fixed for me. |
@Vandell63 I just checked your alternative code again and repeating the "Steps to reproduce" in your example is giving me the same results unfortunately. I can dig deeper and make a PR if necessary, but I'm trying to understand first where the error comes from. |
Yes i see now sorry. You're right !. The error disappear only when you change the I'm pretty sure that it is linked with -> #28 |
Thanks, guys, will investigate the cause of the issue. |
react hook form validate a single field at a time (this allow us to optimize render), if you need to depend field to trigger validation, you can use |
Thanks @bluebill1049! I'm closing the issue then. |
Hi there! First of all I'm not sure if this problem is caused by the resolver, if it's a problem with Yup itself or simply because I don't have a proper understanding of the usage of this two wonderful tools.
So I'm trying to validate a field based on the value of another field (comparing that last date is greater than first date). But the error messages have been rather inconsistent in this case, usually not disappearing when it should. I made a sandbox to reproduce the issue in a simplified way (two numbers, first one should be less than the second one).
Working sandbox: https://codesandbox.io/s/polished-framework-ofvx8
Steps to reproduce:
Desired outcome:
After step 3, the error message on the second input should disappear.
Current outcome:
The error message on the second input remains even though it went through the validation (as showcased in the console). Also note that even if the error message doesn't disappear, the "submit" is now clickable as the form is valid (disabled is form invalid).
The text was updated successfully, but these errors were encountered: