setFormState

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

Overview

action ("setFormState")

Action to be performed.

payload (object)

The new data.

Example

setFormState.json
{
  "$schema": "https://forms.virtimo.net/5.0.x/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: