I’m trying to use JSONForms with a custom radio renderer to handle a oneOf.
The idea is simple: select Natural person OR Legal person via radio buttons → only that branch’s fields should show up.
But when I select an option, no fields are rendered under the radio, even though the radio changes.
“type”: “object”,
“properties”: {
“affectedPerson”: {
“oneOf”: [
{
“title”: “Natural”,
“type”: “object”,
“properties”: {
“affectedPersonNatural”: {
“type”: “object”,
“properties”: {
“firstName”: { “type”: “string” },
“lastName”: { “type”: “string” }
}
}
},
“required”: [“affectedPersonNatural”]
},
{
“title”: “Legal”,
“type”: “object”,
“properties”: {
“affectedPersonLegal”: {
“type”: “object”,
“properties”: {
“companyName”: { “type”: “string” },
“legalForm”: { “type”: “string” }
}
}
},
“required”: [“affectedPersonLegal”]
}
]
}
}
}
UI Schema
{
“type”: “VerticalLayout”,
“elements”: [
{
“type”: “Control”,
“scope”: “#/properties/affectedPerson”,
“label”: “Affected Person”,
“options”: {
“detail”: {
“type”: “VerticalLayout”,
“elements”: [
{
“type”: “Group”,
“label”: “Natural person”,
“elements”: [
{
“type”: “Control”,
“scope”: “#/properties/affectedPersonNatural/properties/firstName”,
“label”: “First name”
},
{
“type”: “Control”,
“scope”: “#/properties/affectedPersonNatural/properties/lastName”,
“label”: “Last name”``}
]
},
{
“type”: “Group”,
“label”: “Legal person”,
“elements”: [`
{
“type”: “Control”,
“scope”: “#/properties/affectedPersonLegal/properties/companyName”,
“label”: “Company name”
},
{
“type”: “Control”,
“scope”: “#/properties/affectedPersonLegal/properties/legalForm”,
“label”: “Legal form”`
}
]
}
]
}
}
}
]
}