Actions
Actions can be used to make the form more interactive for the user. They can be triggered by interacting with a component (see Button onClick, onChange, and onPainted), by a response from the server (for example, during a submission or validation) , or by a message sent 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.
{
"action" : "downloadFile",
"payload": { "fileName": "testfile.txt", "data": "Hello World"}
}
Server Interaction
Message exchange with a server is initiated from the form.
The HTTP methods GET and POST are used for this purpose.
If POST is used, the server can trigger any actions in response.
For actions that use GET, only the data specific to the action can be loaded.
In this case, server interaction generally works similarly to message exchange via an iFrame.
However, the structure of the request and the response differs slightly.
Structure – POST
A request can be triggered, for example, by a submit.
This then sends a POST message to the server with the current URL in the following format:
{
"action" : "METHOD_NAME_THAT_TRIGGERED_REQUEST",
"form" : "COMPLETE_FORM_OBJECT", (1)
"originator" : "ORIGINATOR_OBJECT" (2)
}
| 1 | Contains the current Form Configuration including the current state of the data |
| 2 | Contains information about who or what triggered the message. E.g., a button or an event |
A response is expected as a JSON object in the format shown above.
{
"action" : "METHOD_NAME_WHICH_SHOULD_BE_EXECUTED",
"payload" : {
"_comment": "optional object depending on method"
}
}
Structure – GET
For GET actions, the structure is different because GET messages are used, and no request objects are sent along with them.
Accordingly, GET actions expect the message to match the request directly and be ready for use.
See also getFormConfig.
{
"_comment": "object depending on method"
}