Description
The gform/ajax/post_page_change
event allows developers to execute custom JavaScript logic after a form submission is processed via the new (true) AJAX submission method introduced in Gravity Forms 2.9.
Usage
document.addEventListener( 'gform/ajax/post_page_change', ( event ) => {
// Custom logic here
});
Parameters
- event CustomEvent
The event object.
Examples
This example shows how you can access the form ID and page number when the user moves to a new page in a Gravity Forms multipage form using the new Ajax:
document.addEventListener( 'gform/ajax/post_page_change', ( event ) => {
console.log( event.type, '; Form ID:', event.detail.formId, '; Page Number:', event.detail.pageNumber );
} );
Placement
Your code snippet can be placed in an HTML field on your form or in a theme custom JavaScript file.
See also the JavaScript/jQuery section in this article: Where Do I Put This Code?
Source Code
This filter is located in goToPage()
in assets/js/src/theme/submission/ajax.js.
Since
The filter was added in Gravity Forms 2.9.0