react-jsonschema-form icon indicating copy to clipboard operation
react-jsonschema-form copied to clipboard

Dependencies based on boolean is not working as expected

Open benjaminbours opened this issue 4 years ago • 6 comments

Prerequisites

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

ezgif com-gif-maker (1)

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.

benjaminbours avatar Sep 25 '21 15:09 benjaminbours

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!

samuelneff avatar Sep 26 '21 19:09 samuelneff

Schema dependencies seem to be broken the same way.

robsweet avatar Sep 30 '21 21:09 robsweet

I was able to resolve with oneOf in dependencies

gogulnathv avatar Dec 10 '21 12:12 gogulnathv

I was able to resolve with oneOf in dependencies

@gogulnathv Could you please let me know how I can use oneOf for checkboxes.

siddharth159 avatar Oct 31 '22 05:10 siddharth159

@siddharth159 , it is a bit late but this could be helpful.

I suppose, this solves the case: Link to shared example

mi6o avatar May 05 '23 06:05 mi6o

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.

stale[bot] avatar Aug 03 '24 09:08 stale[bot]

This issue was closed because of lack of recent activity. Reopen if you still need assistance.

stale[bot] avatar Sep 02 '24 18:09 stale[bot]