react-jsonschema-form
react-jsonschema-form copied to clipboard
not working about validation
Prerequisites
- [X] I have read the documentation
- [X] Ideally, I'm providing a sample JSFiddle, Codesandbox.io or preferably a shared playground link demonstrating the issue.
- [X] I have searched the existing issues
- [X] I understand that providing a SSCCE example is tremendously useful to the maintainers.
What theme are you using?
core
Version
5.x
Current Behavior
Expected Behavior
Steps To Reproduce
- click submit button
- change input(neither click set button or type text can not cancel the error message)
https://codesandbox.io/p/devbox/rjsf-validate-gwrxj2
Environment
- OS:
- Node:
- npm:
Anything else?
No response
Sorry, it's difficult to understand what your issue is. By default, validation only runs onSubmit. Is your issue resolved if you enable the liveValidate prop on Form, which triggers validation on change? liveValidate docs
the liveValidate config is useful, but the initialization of the form to trigger the validation. UX is not very good.
Prerequisites
- [x] I have read the documentation
- [x] Ideally, I'm providing a sample JSFiddle, Codesandbox.io or preferably a shared playground link demonstrating the issue.
- [x] I have searched the existing issues
- [x] I understand that providing a SSCCE example is tremendously useful to the maintainers.
What theme are you using?
core
Version
5.x
Current Behavior
Expected Behavior
Steps To Reproduce
- click submit button
- change input(neither click set button or type text can not cancel the error message)
https://codesandbox.io/p/devbox/rjsf-validate-gwrxj2
Environment
- OS: - Node: - npm:Anything else?
No response
What I mean is that when there is a required form item, trigger the submit firstlly, and then after changing the value of the form item, the validation message can not be cancel.
@hans000 Are you trying to make the error go away once the user fixes it? If you don't want the error list to be shown, you could just hide it using the showErrorList prop on Form. If you do want it shown on submit, you could turn it off in a custom onChange() handler and then onSubmit() turn that flag back on. Honestly, I never show error list and just let each field have it errors shown when they happen since they go away once the error is fixed.