formio / formio.js

JavaScript powered Forms with JSON Form Builder

Home Page:https://formio.github.io/formio.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot change the type of a component with Merge Component Schema

maartenvr98 opened this issue · comments

Hi. I'm unable to change the type of a component with logic and Merge Component Schema. This is the JSON right now:

{
  "type": "textfield",
  "input": true,
  "label": "Value",
  "key": "value",
  "logic": [
    {
      "name": "Change Type",
      "trigger": {
        "type": "simple",
        "simple": {
          "show": true,
          "when": "type",
          "eq": "datetime"
        }
      },
      "actions": [
        {
          "name": "updateSchema",
          "type": "mergeComponentSchema",
          "schemaDefinition": "schema = {label: 'test', type: 'datetime'}; return schema;"
        }
      ]
    }
  ]
}

Is it possible to make it work? I can see that the label is changing so I can confirm that the schema is updating.