Actions

Actions can be used to make the form more interactive for the user. They can be triggered by interaction with a component (see Button onClick, onChange and onPainted), by a response from the Server (for example with a Submit or a Validation) or by sending a message to an iFrame.

ActionDefinition

The basic structure is always the same:

action (enum)

Name of the action to be called. The actions listed below are all possible actions. It is not possible to specify other actions.

payload (ActionPayload)

The payload is an object whose structure depends on the respective action. Each action defines its own payload structure.

Example - Download:
{
  "action" : "downloadFile",
  "payload": { "fileName": "testfile.txt", "data": "Hello World"}
}

Server interaction

The message exchange with a server is started from the form. The HTTP methods GET and POST are used for this. If POST is used, the server can trigger any actions in response. For actions that use GET, only the data dependent on the action can be loaded. A server interaction works in a similar way to the message exchange with the iFrame. However, the structure of the call and the response differs slightly.

Structure - POST

A request can be triggered, for example, by a Submit for example. This then sends a POST message to the server with the current url in the following format:

Structure request
{
  "action"     : "METHOD_NAME_THAT_TRIGGERED_REQUEST",
  "form"       : "COMPLETE_FORM_OBJECT", (1)
  "originator" : "ORIGINATOR_OBJECT" (2)
}
1 Enthält die aktuelle Form configuration inklusive des aktuellen Zustands der Daten
2 Enthält Informationen von wem oder was die Nachricht ausgelöst wurde. Z. B. ein Button oder ein Event

A response is expected as a JSON object in the above format above Format.

Structure - Response
{
  "action"  : "METHOD_NAME_WHICH_SHOULD_BE_EXECUTED",
  "payload" : {
    "_comment": "optional object depending on method"
  }
}

Structure - GET

The structure is different for get actions, as GET messages are used and no request objects are sent there. Accordingly, get actions expect that the message matches the request directly and can be used. See also getFormConfig.

Structure - Response
{
  "_comment": "object depending on method"
}

Keywords: