react-jsonschema-form
react-jsonschema-form copied to clipboard
Dependencies based on boolean is not working as expected
Prerequisites
- [x] I have read the documentation;
- [x] In the case of a bug report, I understand that providing a SSCCE example is tremendously useful to the maintainers.
- [x] Ideally, I'm providing a sample JSFiddle or a shared playground link demonstrating the issue.
Description
[Description of the bug or feature]
Property dependencies when using a checkbox / boolean is not working as expected. When it has never been checked, the behavior is ok, but when you uncheck it, the field is still required.
Related to #795
Steps to Reproduce

Expected behavior
I expect the field not to be required anymore when I uncheck the checkox.
Actual behavior
The field is still required after I unchecked the checkbox.
Version
Last version. Or the current online demo version.
Can't help exactly, but I have been working on this exact same issue for the last 5 hours trying several different workarounds. The one that came closest is dynamically updating the schema and changing the required array when the checkbox is checked or un-checked. Unfortunately, updating the schema resets the entire formData, so all data is lost.
Still looking for a fix for this or better would be actual fix within jsonschema-form. Great project!
Schema dependencies seem to be broken the same way.
I was able to resolve with oneOf in dependencies
I was able to resolve with oneOf in dependencies
@gogulnathv Could you please let me know how I can use oneOf for checkboxes.
@siddharth159 , it is a bit late but this could be helpful.
I suppose, this solves the case: Link to shared example
This issue has been automatically marked as possibly close because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.
This issue was closed because of lack of recent activity. Reopen if you still need assistance.