rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.

Home Page:https://rjsf-team.github.io/react-jsonschema-form/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

visible-if required-if

kaihendry opened this issue · comments

Apologies in advance, perhaps this a JSON schema question or my mis-understanding, but I am little confused to how one handles more complex forms in the sense if say an applicant is under 16, a guardian form is then required.

Can that be described in JSON schema, or is that some tweak I can make with react-jsonschema-form?

I can see from http://stackoverflow.com/a/11652478/4534 that you can make things required-if but not visible-if.

That would probably require support for oneOf (#52) and possibly supplementary shenanigans for handling conditionals.

Your best bet for now would be to write your own custom field I think.

Could you please give an example of conditional form as a custom field?

I've been staring at https://github.com/mozilla-services/react-jsonschema-form#custom-field-components and not quite getting it. Should I create separate forms that show only if I can detect certain formData exists in another form?