Description
The gform/ajax/pre_display_confirmation filter allows add-ons to override the default confirmation display behavior after an AJAX form submission. If the handled The property is set to true, the default DOM replacement is skipped.
Usage
gform.addFilter( 'gform/ajax/pre_display_confirmation', async ( data ) => {
// Custom logic here
return data;
} );
Parameters
| Name | Type | Description |
|---|---|---|
| data | Object | The data object containing confirmation information. |
| data.formId | int | The ID of the form being submitted. |
| data.submissionResult | Object | The submission result returned from the server. |
| data.handled | boolean | Whether the confirmation has been handled. Set to true to skip the default DOM replacement. |
Examples
Show the confirmation markup in a modal.
window.gform.utils.addAsyncFilter( 'gform/ajax/pre_display_confirmation', function( data ) {
if ( data.submissionResult.data.confirmation_markup ) {
var mymodal = document.getElementById("my-modal");
mymodal.innerHTML = data.submissionResult.data.confirmation_markup;
mymodal.show();
data.abort = true;
}
return data;
} );
Placement
Reference the article Adding JavaScript Code to the Frontend of Your Site.
Source Code
This filter is located in ajax.js
Since
This filter was added in Gravity Forms 2.9.29.