Hi! JSON Forms currently has no built-in concept to change data based on rules. In general we try to avoid changing data just by rendering. Out of the box this is currently only supported indirectly by handing over a customized AJV to JSON Forms which has some support for adapting data while validating it.
If you would like to implement something like this there are multiple options going forward.
- You could listen from the outside to data changes within JSON Forms and evaluate the same rule (manually or using AJV like we do in JSON Forms) and then adapt the data you hand over to JSON Forms yourself, or
- You can add a custom group renderer which when
visible is evaluated to
false, iterates through all its children controls, resolves their data and sets them to undefined, or
- To not restrict yourself to groups you could also register a full set of custom controls, each responsible on their own to set their own data to
undefined when their
visible is set to false. Note however that at the moment children of
invisible layouts will not even be rendered so you need to adapt this too, or
- If your use case is actually restricted to controls which point to objects (and are therefore by default rendered as a group), it’s sufficient to register a custom object renderer and just call
handleChange(path, undefined) in them when