Skip to main content
Version: 4.62

submitForm

Submits all values of form elements (indicated by the formDataKey attribute, see forms) present on the current view via an HTTP request.

Field Configurations

KeyTypeDescriptionDefault Value
"params" (required)Objectundefinednull

Parameters

KeyTypeDescriptionDefault Value
"additionalHeaders"AdditionalHeadersAdditional HTTP headers to send.null
"appendMosGetParams"Boolean,StringDetermines if the mos. get params should be appended.false
"appendMosHeader"Boolean,StringDetermines if the mos. headers will be appended.false
"async"BooleanSpecifies whether the action should perform asynchronously.null
"complexResponse"Boolean,Stringundefinedfalse
"contentType"StringDetermines if the body should be a JSON or multiPartFormData. Use "json" for JSONnull
"deprecatedDataStructure"Boolean,StringDetermines if the body should be embedded in data. (Only in view form)true
"form"StringName of the form that should be submitted. If not specified, the form of the current view will be used.null
"method"StringThe HTTP method."POST"
"onError"StringEvent that is executed in case of an error.null
"onErrorType"OnErrorTypeType of the onError event."event"
"onSuccess"StringEvent that is executed in case of success.null
"onSuccessType"OnSuccessTypeType of the onSuccess event."event"
"queryMap"ArrayMap for adding database data to the request body.null
"showLoading"Boolean,StringDetermines if the loading overlay should be visible.false
"url"StringThe target URL.null
"useDataKeyForFiles"Boolean,StringDetermines 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

KeyTypeDescriptionDefault Value
"dynamicParams"ObjectDynamic params to retrieve data from a specific context e.g. a userSetting.null
"leadingDelimiter"StringThe leading mustache delimiter to use.null
"params"Object,ArrayObject containing the properties of the action.null
"trailingDelimiter"StringThe trailing mustache delimiter to use.null
"type"StringType name of the action.null

Examples

Example 1: Submit form using JSON

Show ExampleHide Example

Submit the form data from the favoriteThings form as JSON via a POST request, including the UID in the 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

Show ExampleHide Example

Submit the form data from the current view as multiPartFormData via a PUT request and display a loading overlay.

{
"type": "submitForm",
"params": {
"url": "http://somewebpage.com",
"method": "PUT",
"showLoading": true,
"onSuccess": "submitted",
"onError": "notSubmitted"
}
}