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.

jQuery .slideUp Form on Submit

  1. Guys,

    This is the best cash I've spent on a dev tool since I bought Coda. Nice work!

    Now, here's a question. Before I bought Gravity Forms I was using Contact Form 7 and on submission, I would initialize the following jQuery:

    $('#contact-form').slideUp('slow'); $('#form-success').slideDown('slow');

    My contact form would nicely slide away and a previously hidden success message would replace it. This is better than just displaying a message in place of the form because my form is 500px tall and the success message only 150px, so it shifts the rest of the sidebar content up and the design stays intact.

    Is there a way to replicate this behavior with Gravity Forms?

    Posted 13 years ago on Monday April 4, 2011 | Permalink
  2. Hi Brian,

    Assuming your form is using the AJAX submission feature, you can bind your function to the gform_confirmation_loaded javascript event. Here is some sample code:

    [js]
    <script type="text/javascript">
    
    jQuery(document).bind('gform_confirmation_loaded', function(){
    
        alert('Confirmation Loaded!');
    
    });
    
    </script>
    Posted 13 years ago on Monday April 4, 2011 | Permalink
  3. Thanks David,

    <script type="text/javascript">
       jQuery(document).bind('gform_confirmation_loaded', function(){
         $('#contact-form').slideUp('slow'); $('#form-success').slideDown('slow');
       });
    </script>

    So do I understand correctly that I can active Ajax submission and insert the above code just above the </body> tag of my page and expect to see correct behavior?

    Posted 13 years ago on Tuesday April 5, 2011 | Permalink
  4. You'd want it in the <head> section which would be above the body tag; but yes, assuming the IDs you are targeting with your jQuery animations are correct, that should work. :)

    Posted 13 years ago on Tuesday April 5, 2011 | Permalink
  5. Hmm, not working on the first effort.

    Just to clarify, when I go to Widgets and look at the advanced options for that instance of the form, I have Enable AJAX checked, Disable script output unchecked.

    Posted 13 years ago on Tuesday April 5, 2011 | Permalink
  6. Can you post a link to the form so I can check it out?

    Posted 13 years ago on Tuesday April 5, 2011 | Permalink
  7. http://test.dalworthrestoration.com/

    Posted 13 years ago on Tuesday April 5, 2011 | Permalink
  8. Try replacing your script block with this updated code: http://pastie.org/1760487

    Posted 13 years ago on Tuesday April 5, 2011 | Permalink
  9. Like a Boss.

    Thanks David!

    Posted 13 years ago on Wednesday April 6, 2011 | Permalink