-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Custom validation error doesn't hide on good result #4365
Comments
@shishmak First of all, you are using
When doing a console.log of your Perhaps once you fix things with |
@heath-freenome I fixed the mobX errors and added an example on React States. The error remained in both places |
@shishmak @heath-freenome any update on this? I am running into the same issue after attempting to upgrade RJSF where errors inserted via a custom validator remain in |
@donalddalton Can you provide an example in a code sandbox (or shared playground) that we can use to determine whether your issue is a regression for #4188 ? |
@heath-freenome sure thing! Here is a crude example recapitulating the scenario @shishmak described above https://codesandbox.io/p/sandbox/rjsf-example-4m3stz. This example uses version 5.20.0/MUI/ajv6. You can reproduce by:
|
@abdalla-rko Hey Appie, let's chat in Discord about this next week. You introduced a regression with your #4188 changes |
Prerequisites
What theme are you using?
utils
Version
5.x
Current Behavior
Hello,
I need to have custom validation depense with 2 fields
Previosly I use rjsf 3.x and all works good. I upgrade project to 5.x and find bug (as I think).
I have a form with a dependency "Test" <= "Test2". I applied a custom validation where I specified this dependency.



const validate = (formData: any, errors: FormValidation) => { if (formData["Test"] > formData["Test2"]) errors["Test"]?.addError("Test should be LE than Test2"); return errors; };
And I noticed a problem:
Let's say initially I have Test = 10 and Test2 = 15
If I set Test2 = 5, then an error will appear near Test. This is the correct behavior
If I return Test2 = 15, then the error will not disappear. And this looks like a bug, because the values Test (10) and Test2 (15) satisfy the condition "Test" <= "Test2"
example of my code:
https://codesandbox.io/p/sandbox/yyrxsp
Expected Behavior
If no validation errors are found, then no errors should be shown.
This error should not be there,

because according to the code the condition = false
const validate = (formData: any, errors: FormValidation) => { if (formData["Test"] > formData["Test2"]) errors["Test"]?.addError("Test should be LE than Test2"); return errors; };
Test < Test2 (10 < 15)
Steps To Reproduce
https://codesandbox.io/p/sandbox/yyrxsp
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: