submitForm
Submits the content of a form via HTTP request.
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"params" (required) | Object | undefined | null |
Parameters
Key | Type | Description | Default Value |
---|---|---|---|
"additionalHeaders" | AdditionalHeaders | Additional HTTP headers to send. | null |
"appendMosGetParams" | Boolean,String | Determines if the mos. get params should be appended. | false |
"appendMosHeader" | Boolean,String | Determines if the mos. headers will be appended. | false |
"async" | Boolean | Specifies whether the action should perform asynchronously. | null |
"complexResponse" | Boolean,String | undefined | false |
"contentType" | String | Determines if the body should be a JSON or multiPartFormData. Use "json" for JSON | null |
"deprecatedDataStructure" | Boolean,String | Determines if the body should be embedded in data . (Only in view form) | true |
"form" | String | Name of the form that should be submitted. If not specified, the form of the current view will be used. | null |
"method" | String | The HTTP method. | "POST" |
"onError" | String | Event that is executed in case of an error. | null |
"onErrorType" | OnErrorType | Type of the onError event. | "event" |
"onSuccess" | String | Event that is executed in case of success. | null |
"onSuccessType" | OnSuccessType | Type of the onSuccess event. | "event" |
"queryMap" | Array | Map for adding database data to the request body. | null |
"showLoading" | Boolean,String | Determines if the loading overlay should be visible. | false |
"url" | String | The target URL. | null |
"useDataKeyForFiles" | Boolean,String | Determines if the data key of a file picker should be used as the file field. (Only in view form) | false |
Inherited
From Base Action
Base Action
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"dynamicParams" | Object | Dynamic params to retrieve data from a specific context e.g. a userSetting. | null |
"leadingDelimiter" | String | The leading mustache delimiter to use. | null |
"params" | Object,Array | Object containing the properties of the action. | null |
"trailingDelimiter" | String | The trailing mustache delimiter to use. | null |
"type" | String | Type name of the action. | null |
Examples
Example 1: submit form using json
Submit the form data of the form favoriteThings
as json via POST request, adding the UID as a header.
{
"type": "submitForm",
"params": {
"url": "http://example.com",
"method": "POST",
"contentType": "json",
"form": "favoriteThings",
"additionalHeaders": [
{
"type": "userSetting",
"headerName": "device",
"key": "AF_SETTING_USERUID"
}
]
}
}
Example 2: submit form using multiPartFormData
Submit the form data of the current view as multiPartFormData via PUT request and display loading overlay.
{
"type": "submitForm",
"params": {
"url": "http://somewebpage.com",
"method": "PUT",
"showLoading": true,
"onSuccess": "submitted",
"onError": "notSubmitted"
}
}
The actions to be executed are specified in the actions
parameter, in this case a submitForm action.
Result:
A submitForm action has been created.