Conditional Default Value in JSONForm

91 Views Asked by At

Is it possible to have a conditional default value?

I have an element called extract, which is boolean. It has a default value to be true.

But I also have a rule to hide this field based on property of the other element:

JSON

{
  "type": "Control",
  "scope": "#/properties/extract",
  "label": "Extract",
  "rule": {
    "effect": "HIDE",
    "condition": {
      "scope": "#/properties/fieldType",
      "schema": {
        "enum": [
          "custom type",
          "list of a custom type",
          "list of lists of a custom type"
        ]
      }
    }
  }
}

I have tried below:

{
  "type": "Control",
  "scope": "#/properties/extract",
  "label": "Extract",
  "rule": {
    "effect": "HIDE",
    "condition": {
      "scope": "#/properties/fieldType",
      "schema": { "enum":  [
               "custom type",
               "list of a custom type",
               "list of lists of a custom type"
       ]},
      "default": false
    }
  }
}

But it is not working. Is it possible to remove default value when it hides?

0

There are 0 best solutions below