Response hooks
- onResponse()
Called prior to processing the Form submission’s response, which handles actions like downloading a file, displaying a success message, and/or redirecting to another URL.
- Arguments:
response (
object()) –The response object may have the following defined:
response.downloadURL of a file to downloadresponse.redirectURL to redirect to.response.validationErrorsArray of fields with validation errors.response.errorMessageString with an error message.response.successTRUE if the Form was submitted successfully.response.successMessageString with a success message.
- Returns:
bool|NULL|void Return TRUE to skip the default behavior for handling the response.
MauticFormCallback['formname'] = {
onResponse: function (response) {
// do something custom
},
};
- onResponseStart()
Called prior to the default processing of the response.
- Arguments:
response (
object()) –The response object may have the following defined:
response.downloadURL of a file to downloadresponse.redirectURL to redirect to.response.validationErrorsArray of fields with validation errors.response.errorMessageString with an error message.response.successTRUE if the Form was submitted successfully.response.successMessageString with a success message.
- Returns:
void
MauticFormCallback['formname'] = {
onResponseStart: function (response) {
// do something custom
},
};
Note
This isn’t called if an onResponse() hook returns TRUE.
- onResponseEnd()
Called after to the default processing of the response.
- Arguments:
response (
object()) –The response object may have the following defined:
response.downloadURL of a file to downloadresponse.redirectURL to redirect to.response.validationErrorsArray of fields with validation errors.response.errorMessageString with an error message.response.successTRUE if the Form was submitted successfully.response.successMessageString with a success message.
- Returns:
void
MauticFormCallback['formname'] = {
onResponseEnd: function (response) {
// do something custom
},
};
Note
This isn’t called if an onResponse() hook returns TRUE or if the page redirects.