Description
Fires on multi-page forms with AJAX submission enabled when changing pages (i.e. going to the next or previous page).
Usage
<script type="text/javascript">
jQuery(document).on('gform_page_loaded', function(event, form_id, current_page){
// code to be trigger when next/previous page is loaded
});
</script>
Parameters
- event Event ObjectThe Javascript Event Object.
- form_id integerThe ID of the form in use.
- current_page integerThe page number of the page being loaded.
Examples
Cufon Script
This event is very useful when the popular font substitution script Cufon is being applied to a Gravity Form which uses the multi-page functionality and the AJAX form submission functionality. The snippet below provides an example usage of the gform_page_loaded event to refresh the Cufon font substitution for the newly loaded page.
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(document).on('gform_page_loaded', function(){
Cufon.refresh('h1,h2,h3,h4,h5,h6');
});
});
</script>
Google Analytics
This example shows how to add Google Analytics tracking to every page in a multi-page form:
<script type="text/javascript">
jQuery(document).on('gform_page_loaded', function(event, form_id, current_page){
_gaq.push(['_trackPageview'], window.location.pathname + current_page);
});
</script>
Placement
This code can be placed in an HTML field on your form or you may use the gform_pre_render hook to echo the script block to the page.
Source Code
This filter is located in form_display.php