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.

Forms not working on Ajax site

  1. I am using ajax to load the pages for my site, but GravityForms aren't working. I saw another topic with this answer:

    "Sounds like you need to enqueue the scripts/CSS manually. You can do this by adding a snippet to your functions.php file. You can find that at the bottom of this page.

    http://www.gravityhelp.com/documentation/embedding-a-form/"

    However, that link does not work.

    Posted 14 years ago on Monday July 18, 2011 | Permalink
  2. That documentation page has moved. It is located here:

    http://www.gravityhelp.com/documentation/page/Embedding_A_Form

    The function call used to enqueue the necessary scripts is documented here:

    http://www.gravityhelp.com/documentation/page/Gravity_form_enqueue_scripts

    Posted 14 years ago on Monday July 18, 2011 | Permalink
  3. What exactly do I need to put into my functions.php file?

    wp_enqueue_script or gravity_form_enqueue_scripts?

    Posted 14 years ago on Monday July 18, 2011 | Permalink
  4. wp_enqueue_script is a WordPress function, not a Gravity Forms function although Gravity Forms does use that function behind the scenes.

    You need to use gravity_form_enqueue_scripts to enqueue necessary Gravity Forms scripts. So that would go in your functions.php file.

    Posted 14 years ago on Monday July 18, 2011 | Permalink
  5. Hi Carl, appreciate the assistance, but it's still not working. I'm probably just not understanding something simple from the documentation.

    Here's what I've tried in my functions.php file:
    gravity_form_enqueue_scripts(1, true);
    gravity_form_enqueue_scripts(2, false);
    gravity_form_enqueue_scripts(3, false);

    when it didn't work, I tried:
    wp_enqueue_script('gravity-forms-php', 'http://www.calicreativeweddings.com/wp-content/plugins/gravityforms/gravityforms.php', array(), false, true);
    gravity_form_enqueue_scripts(1, true);
    gravity_form_enqueue_scripts(2, false);
    gravity_form_enqueue_scripts(3, false);

    When those didn't work I also tried in header.php just before wp_head() (as instructed on the link you posted):
    <?php
    gravity_form_enqueue_scripts(1, true);
    gravity_form_enqueue_scripts(2, false);
    gravity_form_enqueue_scripts(3, false);
    ?>

    If you want to check it out, the site is at http://www.calicreativeweddings.com and the Investment->Cinematography page has a price form. The Contact page has a regular form... which is showing up and appears to be styled, but has no functionality.

    Thanks,
    -brian

    Posted 14 years ago on Monday July 18, 2011 | Permalink
  6. Hi Bossturbo,

    1 - Could you point out a couple pages where you are attempting to load a Gravity Form without success?
    2 - You mentioned that you're loading the pages via ajax. Since Gravity Forms runs a javascript function to handle conditional fields when the page is loaded, I suspect the issues lies in the fact that the form was not loaded when the page was loaded.
    3 - If you send me FTP access and a WP login I will take a look and see about a solution.

    Posted 14 years ago on Monday July 18, 2011 | Permalink
  7. Hi David,

    Sure:

    1)
    a) http://www.calicreativeweddings.com/#/contact/ - form shows up and is styled, but submit button doesn't do anything, the ajax validation doesn't work and the date picker isn't showing up.
    b) http://www.calicreativeweddings.com/#/investment/cinematography/ - there is a price form at the bottom that does not show up, same with http://www.calicreativeweddings.com/#/investment/photography/

    2) I used this tutorial to make my ajax page loading: http://www.deluxeblogtips.com/2010/05/how-to-ajaxify-wordpress-theme.html. I posted a comment asking for help there too and someone responded with "You should change the jQuery selectors above to exclude elements belong to Gravity Forms (such as buttons, fields)." He is referring to this:

    $(document).delegate("a[href^='"+siteUrl+"']:not([href*=/wp-admin/]):not([href*=/wp-login.php]):not([href$=/feed/])", "click", function() {
        location.hash = this.pathname;
        return false;
    });

    in the ajax.js file. But I don't know what I should change or if that is a correct answer.

    3) I will be glad to send the required information, how do I send it to you privately? I don't see any way to private message on here.

    Thanks,
    -brian

    Posted 14 years ago on Tuesday July 19, 2011 | Permalink
  8. Hi Brian,

    You can send the FTP and WP admin credentials to david@rocketgenius.com.

    Posted 14 years ago on Tuesday July 19, 2011 | Permalink
  9. sent.

    Posted 14 years ago on Tuesday July 19, 2011 | Permalink
  10. Hi Guys, It's still not working. The GF documentation is more confusing than helpful to me for this topic, sorry.

    What exactly do I need to put in my functions.php file?

    What exactly do I need to put in the ajax javascript file on page load?

    Posted 14 years ago on Saturday July 23, 2011 | Permalink