If a user select Option A, it will show the required field.
After selecting Option A, user change his selection to Option B.
However, the the hidden required field in Option A still show up in the error logs even when user select option B for form submission.
App.js: 105 is the error log. “console.log(errors)”
-
Onload
-
After user select Option A.
-
User change his selection to Option B
How can I remove the error of required field if user select Option B?
schema.json
{
"type": "object",
"properties": {
"optionSelection": {
"title": "Select Option",
"type": "object",
"properties": {
"options": {
"type": "string",
"enum": [
"Option A",
"Option B",
"Option C"
]
},
"textField": {
"type": "string"
},
"number": {
"type": "string",
"maxLength": 3
}
},
"required": [
"textField"
]
}
}
}
uiSchema.json
{
"type": "VerticalLayout",
"elements": [
{
"type": "Group",
"label": "Form",
"elements": [
{
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/optionSelection/properties/options"
},
{
"type": "HorizontalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/optionSelection/properties/textField"
},
{
"type": "Control",
"scope": "#/properties/optionSelection/properties/number"
}
],
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#properties/optionSelection/properties/options",
"schema": {
"enum": [
"Option A"
]
}
}
}
}
]
}
]
}
]
}