e.g i have a enum in the json schema with values [“a,”, “b”,“c”, “d”] and i have textbox defined in schema. When i write uischema, , the enum value becomes html multiselect and i want the textbox to be disabled if “d” value is chosen in the multiselect. How do i apply this in “rules”? any example link to the documentation would be helpful, thanks, have a great day
If i have schema like this below, how should i write the rules, for example i want to have textbox disabled, when the user selects Apple or mango “fruits”: {
“type”: “array”,
“items”: {
“type”: “object”,
“properties”: {
“fruit”: {
“type”: “string”,
“enum”: [
“NONE”,
“APPLE”,
“ORANGE”,
“mango”,
“guava”
]
}
}
}
} i tried from the above rule, and it doesn't work as expected
Thanks, @sdirix(sdirix). I have a scenario like the “name” property is a standalone property and not a part of array objects. What is the “scope” to disable the control in the rule? (like #/properties/fruits/items/properties/type)
Depends on what you want to validate against. For example you could validate against the array in general with the scope #/properties/fruits and specify a rule-schema with properties for the array, e.g. containing at least 3 items and one of them being mango.
Hi @sdirix(sdirix), This is my schema { “type”: “object”, “properties”: { “fruits”: { “type”: “array”, “items”: { “type”: “object”, “properties”: { “type”: { “type”: “string”, “enum”: [ “none”, “apple”, “orange”, “mango”, “guava” ] } } } }, “name”: { “type”: “string” } } } How can I disable the “name” property in the UI schema, based on the “type” property inside the array fruits?
Hi @sdirix, How can I disable the “name” control, if the array contains “mango” type. The enum is not working fo for me. The enum is expecting all the matching values in the array. Also, the rule is not supporting multiple conditions. I am using “oneOf” to implement multiple conditions. But it’s not working for me.