I am trying to get the current page in Gravity Forms Multi pages. I have included my form as a shortcode on the page like: {!! do_shortcode('[gravityform id="1" title="false" ajax="true"]') !!} which loads the form in fine. In Javascript I got the following code as found in the documentation:
jQuery(document).on('gform_post_render', (event, form_id, current_page) => {
console.log(current_page);
});
But on page load, or the change of steps in the form this is never been triggered.
I am using: Wordpress: 6.2.2 ( using Roots/Sage ) GravityForms 2.7.9
I have also been trying to add the following code in my functions.php
add_filter( 'gform_pre_render', 'current_page' );
function current_page( $form ) {
$current_page = rgpost('gform_source_page_number_' . $form['id']) ? rgpost('gform_source_page_number_' . $form['id']) : 1;
echo '<pre>';
var_dump($current_page);
// var_dump(GFFormDisplay::get_current_page( $form_id ));
echo '</pre>';
return $form;
}
But when I choose the form with AJAX then this always returns 1