Rules: Show Control based upon value existing in array

The following cut down example allows a select if set to Other to show the Other textfield:

schema.json

"question_set": {
  "type": "object",
  "title": "Questions",
  "properties": {
    "question": {
      "type": ["string", "null"],
      "title": "Question",
      "enum": ["Option 1", "Option 2", "Other"]
    },
    "question_other": {
      "type": ["string", "null"],
      "title": "If other, give detail"
    }
}

uischema.json

{
  "type": "Group",
  "label": "Specs",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/question_set/properties/question"
    },
    {
      "type": "Control",
      "scope": "#/properties/question_set/properties/question_other",
      "rule": {
        "effect": "SHOW",
        "condition": {
          "scope": "#/properties/question_set/properties/question",
          "schema": { "const": "Other" }
        }
      }
    }

I’m having issues replicating this case when the source question is a multiselect. Regardless of ‘Other’ being selected it doesn’t appear to work:

schema.json

"question_set": {
  "type": "object",
  "title": "Questions",
  "properties": {
    "question": {
      "type": ["array", "null"],
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "Option 1",
          "Option 2",
          "Other"
        ]
      },
      "title": "question"
    },
    "question_other": {
      "type": ["string", "null"],
      "title": "If other, give detail"
    }
  },

uischema.json

{
  "type": "Group",
  "label": "Questions",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/question_set/properties/question"
    },
    {
      "type": "Control",
      "scope": "#/properties/question_set/properties/question_other",
      "rule": {
        "effect": "SHOW",
        "condition": {
          "scope": "#/properties/question_set/properties/question",
          "schema": { "enum": ["Other"] }
        }
      }
    }
  ]
},

There doesn’t appear to be an example of conditional display based upon a multi-select.

Any guidance greatly appreciated.

Rob.

Resolved: required contains instead… I’m sure I tried that several hours ago!

{
  "type": "Group",
  "label": "Questions",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/question_set/properties/question"
    },
    {
      "type": "Control",
      "scope": "#/properties/question_set/properties/question_other",
      "rule": {
        "effect": "SHOW",
        "condition": {
          "scope": "#/properties/question_set/properties/question",
          "schema": { "contains": { "const": "Other" } }
        }
      }
    }
  ]
},
1 Like