3

i am using json-forms with react and i want to introduce condition where category is hidden and it will show depending on object inside an array.

here is pseudo schema

       var schema = {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "alive": {
          "type": "array",
          "items": {
                "type": "boolean"
            }
        },
        "kindOfDead": {
          "type": "string",
          "enum": [
            "Zombie",
            "Vampire",
            "Ghoul"
          ]
        }
      }
    }



    var uiSchema = {
      "type": "Categorization",
      "elements": [
        {
          "type": "Category",
          "label": "Private",
          "elements": [
            {
          "type": "Control",
          "label": "Name",
          "scope": "#/properties/name"
            }
          ]
        },
        {
          "type": "Category",
          "label": "public",
"rule": {
            "effect": "DISABLE",
            "condition": {
              "scope": "#/properties/alive",
              "schema": {
                "kindOfDead": true
              }
            }
          },
          "elements": [
            {
          "type": "Control",
          "label": "Kind of dead",
          "scope": "#/properties/kindOfDead"
        }
          ]
        }
      ]
    }

    var data = {
      "name": "John Doe",
      "alive": [
          isZombie:true,
      ],
        "kindOfDead": "Zombie"
    }

so in this case depends on the isZombie value the tab should be disabled or enabled. and the value of the isZombie is provided from pre sent data nor from user

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.