PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Using gform_post_render slows down my Form

  1. Im 100% sure I've written terrible jQuery and I shouldn't be let near a keyboard again lol.

    Here is my form http://designfitz.com/product/thesis/

    when you click 'Front & Spine' radio button it takes aaages to change, but if i remove this code its fixed, I'm sure im using gform_post_render wrong. Any ideas how I could tidy up this code? and use gform_post_render correctly?

    // Total Books for Delivery 1
    
        jQuery(function() {
        firstdeliverytotal();
        }
            );
        jQuery(".steve select").change(function() {
        firstdeliverytotal();
        jQuery(document).trigger('gform_post_render', [7,1])
    
        }
                                   );
    
        function firstdeliverytotal()
        {
        var totalPoints = 0;
        jQuery('.steve option:selected').each(function(){
          totalPoints = parseFloat(jQuery(this).text()) + totalPoints;
        }
                                            );
    
        jQuery("#input_7_16").val(totalPoints);
        jQuery(document).trigger('gform_post_render', [7,1])
    
        }
        ;
    
        // Total Books for Delivery 2
    
        jQuery(function() {
        seconddeliverytotal();
        }
            );
        jQuery(".smith select").change(function() {
        seconddeliverytotal();
        jQuery(document).trigger('gform_post_render', [7,1])
    
        }
                                   );
    
        function seconddeliverytotal()
        {
        var totalPoints2 = 0;
        jQuery('.smith option:selected').each(function(){
          totalPoints2 = parseFloat(jQuery(this).text()) + totalPoints2;
        }
                                            );
    
        jQuery("#input_7_119").val(totalPoints2);
        jQuery(document).trigger('gform_post_render', [7,1])
        }
        ;
    
        // Total Hardbacks for Delivery1
        jQuery(function() {
        hardbacksdelivery1();
        }
            );
        jQuery("#input_7_106,#input_7_105").change(function() {
        hardbacksdelivery1();
        jQuery(document).trigger('gform_post_render', [7,1])
    
        }
                                   );
    
        function hardbacksdelivery1()
        {
        var totalhardbacks1 = 0;
        jQuery('.hardback1 option:selected').each(function(){
          totalhardbacks1 = parseFloat(jQuery(this).text()) + totalhardbacks1;
    
        }
                                            );
    
        jQuery("#input_3_11").val(totalhardbacks1);
        jQuery("#input_7_118").val(totalhardbacks1);
            jQuery(document).trigger('gform_post_render', [7,1])
        }
        ;
    
        // Total Hardbacks for Delivery2
        jQuery(function() {
        totalhardbacks2();
        }
            );
        jQuery("#input_7_109,#input_7_108").change(function() {
        totalhardbacks2();
        jQuery(document).trigger('gform_post_render', [7,1])
    
        }
                                   );
    
        function totalhardbacks2()
        {
        var totalhardbacks2 = 0;
        jQuery('.hardback2 option:selected').each(function(){
          totalhardbacks2 = parseFloat(jQuery(this).text()) + totalhardbacks2;
    
        }
                                            );
    
        jQuery("#input_7_123").val(totalhardbacks2);
    
            jQuery(document).trigger('gform_post_render', [7,1])
        }
        ;
    Posted 10 years ago on Monday May 20, 2013 | Permalink