Gform confirmation loaded

(Created page with "__NOTOC__ == Description == Fired on AJAX-enabled forms when the confirmation page is loaded. == Usage == <pre class="brush:js"> <script type="text/javascript"> jQuery(docume...")
(Examples)
 
Line 33: Line 33:
         jQuery(document).bind('gform_confirmation_loaded', function(){
         jQuery(document).bind('gform_confirmation_loaded', function(){
             Cufon.refresh('h1,h2,h3,h4,h5,h6');
             Cufon.refresh('h1,h2,h3,h4,h5,h6');
 +
        });
 +
       
 +
    })
 +
</script>
 +
</pre>
 +
 +
Here is another example where the form ID parameter is used to run different code depending on which form's confirmation is being loaded.
 +
 +
<pre class="brush:php">
 +
<script type="text/javascript">
 +
    jQuery(document).ready(function(){
 +
 +
        jQuery(document).bind('gform_confirmation_loaded', function(event, form_id){
 +
            if(form_id == 1) {
 +
                // run code specific to form ID 1
 +
            } else if(form_id == 2) {
 +
                // run code specific to form ID 2
 +
            }
         });
         });
          
          

Latest revision as of 12:54, 6 July 2012

Description

Fired on AJAX-enabled forms when the confirmation page is loaded.

Usage

<script type="text/javascript">

jQuery(document).bind('gform_confirmation_loaded', function(event, form_id){
    // code to be trigger when confirmation page is loaded
});

</script>

Parameters

event
(object) The Javascript event object.
form_id
(integer) The ID of the form submitted.

Examples

This event is very useful when the popular font substitution script Cufon is being applied to a Gravity Form which uses the AJAX form submission functionality. The snippet below provides an example usage of the gform_confirmation_loaded event to refresh the Cufon font substitution when the confirmation page is loaded.

<script type="text/javascript">
    jQuery(document).ready(function(){

        jQuery(document).bind('gform_confirmation_loaded', function(){
            Cufon.refresh('h1,h2,h3,h4,h5,h6');
        });
        
    })
</script>

Here is another example where the form ID parameter is used to run different code depending on which form's confirmation is being loaded.

<script type="text/javascript">
    jQuery(document).ready(function(){

        jQuery(document).bind('gform_confirmation_loaded', function(event, form_id){
            if(form_id == 1) {
                // run code specific to form ID 1
            } else if(form_id == 2) {
                // run code specific to form ID 2
            }
        });
        
    })
</script>

Source Code

This filter is located in form_detail.php

Search the Documentation