I have some fields that are conditionally visible based on rules in the uischema
. My problem is that hidden fields, which are not visible to the user, are still marked as required, causing validation issues. I want to ensure that only the visible required fields are validated. Hidden fields should be ignored during validation, so the form should pass as long as all visible required fields are filled out correctly, I dont want to use if/else/then because i will have the asterix problem can you give some advices thank you !
Hi @Naatl,
There is a conceptual issue with your request: JSON Schema validation and visibility are evaluated separately from each other, therefore the visibility can not influence the validation.
Some potential solutions:
- Aligning JSON Schema validation with the UI Schema rules and then working around a potential dynamic required issues, OR
- Instead of using UI Schema rules, you evaluate your rules outside of JSON Forms and hand in a modified JSON Schema to JSON Forms which includes / excludes the fields you would like to see, OR
- Filter errors for invisible fields