Formly JSON form - How to reset value of input when the select option changes

92 views Asked by At

I am trying to reset value of input text whenever the selected option changes I have tried with this config but it's not working.


  fields: FormlyFieldConfig[] = [
    {
      "key": "selectField",
      "type": "select",
      "props": {
        "label": "Select Field",
        "options": [
          { "label": "Option 1", "value": "option1" },
          { "label": "Option 2", "value": "option2" },
          { "label": "Option 3", "value": "option3" }
        ]
      }
    },
    {
      "key": "textInput",
      "type": "input",
      "props": {
        "label": "Text Input"
      },
      "expressions": {
        "model.textInput": "model.selectField ? '' : model.textInput"
      }
    }
  ]

0

There are 0 answers