Conditional Default Value in JSONForm

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:

{
  "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?

Leave a Comment