# How to apply composable condition in uischema?

**URL:** <https://jsonforms.discourse.group/t/how-to-apply-composable-condition-in-uischema/71>\
**Category:** General\
**Created:** [December 3, 2020, 5:13am UTC](https://jsonforms.discourse.group/t/how-to-apply-composable-condition-in-uischema/71 "2020-12-03T05:13:57Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [December 4, 2020, 9:53am UTC](https://jsonforms.discourse.group/t/how-to-apply-composable-condition-in-uischema/71/6 "2020-12-04T09:53:07Z")

</div>

When you want to cover multiple attributes, then you need to choose a scope which can cover both. Then within the `schema` field you need to specify a schema which will validate successfully whenever your effect shall apply.

JSON Schema:

```auto
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "yesOrNo": {
      "type": "string",
      "enum": [
        "yes",
        "no"
      ]
    }
  }
}

```

UI Schema:

```auto
{
  "type": "VerticalLayout",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/name",
      "rule": {
        "effect": "DISABLE",
        "condition": {
          "scope": "#",
          "schema": {
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "const": ""
                  }
                }
              },
              {
                "type": "object",
                "properties": {
                  "yesOrNo": {
                    "const": "yes"
                  }
                },
                "required": [
                  "yesOrNo"
                ]
              }
            ]
          }
        }
      }
    },
    {
      "type": "Control",
      "scope": "#/properties/yesOrNo"
    }
  ]
}

```

The schema in the rule is scoped against the root object. It will validate successfully when

- `yesOrNo` exists and is set to `yes` AND

- `name` either doesn’t exist or is empty

Note that this is nothing special about JSON Forms and just regular [JSON Schema validation](https://json-schema.org/draft/2019-09/json-schema-validation.html).

---

_[View the full topic](https://jsonforms.discourse.group/t/how-to-apply-composable-condition-in-uischema/71)._
