setFormState

This function sets the specified data to the state. The data is not completely replaced, but merged.

Overview

action ("setFormState")

Action to be executed.

payload (object)

The new Data.

Example

setFormState.json
{
  "$schema": "https://forms.virtimo.net/5.1.0/schema.json",
  "metaData": {
    "id": 0,
    "version": 0
  },
  "configuration": {
  },
  "components": [
    {
      "type": "container",
      "components": [
        {
          "type": "button",
          "label": "setFormState",
          "onClick": {
            "action": "setFormState",
            "payload": {
              "data": {
                "text": "New text"
              }
            }
          }
        },
        {
          "type": "textfield",
          "value": "${/data/text}"
        }
      ]
    }
  ],
  "state": {
    "data": {
      "text": "Hello"
    }
  }
}
Embedded preview

Keywords: