In reference to this issue: No rule validation for "array contains value" when array undefined
Is it possible to use the rule validation to display a control field only when a specific checkbox (from a string array) is selected and as long as no option is selected to hide it?
For example, with this schema:
{
"type": "object",
"properties": {
"stringArray": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"enum": [
"Option1",
"Option2",
"Other"
]
}
},
"textOther": {
"type": "string"
}
}
},
And this ui-schema:
{
"type": "Control",
"scope": "#/properties/stringArray/properties/textOther",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/stringArray/properties/textOther",
"schema": {
"contains": {
"const": "Other"
}
}
}
}
}
the expected behaviour is that when the array is still undefined, the control for textOther is not displayed.
I thought one option would be to use a rule with hide and “does not contain”, though “Not” is not supported in rules.
How else is it possible to achieve the expected behaviour?