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.

Ajax submission not working on hard coded form

  1. tinker
    Member

    I have hard coded my form like so...

    <?php gravity_form(2, false, false, false, '', true); ?>

    The last 'true' being the call for ajax submission functionality. For some reason I am not getting any ajax functionality, just a regular page load instead. Any ideas?

    Jquery is in use in the same page but that should not be causing any issues.

    Posted 12 years ago on Thursday September 15, 2011 | Permalink
  2. When you call a form with the function call like that, you need to ensure the CSS and scripts are enqueued. Have you done that?

    Enqueue Scripts and Styles on this page
    http://www.gravityhelp.com/documentation/page/Embedding_A_Form

    Posted 12 years ago on Thursday September 15, 2011 | Permalink
  3. tinker
    Member

    Thanks Chris. I added the following directly before the head tag...
    <?php gravity_form_enqueue_scripts(2, true); ?>

    Unfortunately it is still reloading the page. The form ID is correct.

    Posted 12 years ago on Thursday September 15, 2011 | Permalink
  4. Can you post a link to your form please?

    Posted 12 years ago on Thursday September 15, 2011 | Permalink
  5. tinker
    Member

    Sure.

    Please do not hyperlink this in the post as I don't want it linked.

    http:// gs-test2.com /help-support/

    You have to click the "ask us a question tab" to see the form.

    Thanks again.

    Posted 12 years ago on Thursday September 15, 2011 | Permalink
  6. I submitted a test with a validation error to see how it returned. It flashed briefly with the error message, then reloaded what is the default view, the first tab I think. I clicked the "ask us a question" again and then I saw my validation error and the form.

    I suspect it has something to do with the tabs.

    Can you embed the form in the same manner, in another page WITHOUT the tabs, and see if things work properly? If they do, then it's likely an issue between the two scripts that needs to be resolved (between Gravity Forms AJAX and however the tabs are being handled.)

    Posted 12 years ago on Friday September 16, 2011 | Permalink
  7. tinker
    Member

    Thanks.

    I removed the tab functionality. I also removed the jquery, jqueryUI and jquery cookie API links and I am still experiencing the same problem.

    Posted 12 years ago on Saturday September 17, 2011 | Permalink
  8. Do you have a link to that new page?

    Posted 12 years ago on Saturday September 17, 2011 | Permalink
  9. tinker
    Member

    Sure... http:// gs-test2.com /help-support-2/

    Thanks for looking into this. I have deleted the tabs from the page but left jquery etc in the head as I will be needing it site wide.

    Posted 12 years ago on Tuesday September 20, 2011 | Permalink
  10. I do see one JavaScript error on the page:

    Error: navigator.appVersion.match(/MSIE (\d\.\d)/) is null
    Source File: http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE7.js
    Line: 6

    Not sure if it's related, but I'm looking into it

    Posted 12 years ago on Wednesday September 21, 2011 | Permalink
  11. One other thing I noticed is that I could not load a new reCAPTCHA. The first one was really bad, but I could not refresh it. That is interesting.

    Posted 12 years ago on Wednesday September 21, 2011 | Permalink
  12. Something is wrong with the way you're embedding the form. The AJAX parameter is not true, because when the form is rendered, there is nothing about AJAX in the source of the page. If you view the source of a page with a Gravity Form embedded with AJAX, the word "ajax" appears in there several times in specific places. Your source does not contain ajax at all, which makes me think the parameters in the function call are wrong.

    Which version of the plugin are you using? I know some additional parameters were added to the function call to embed a form.

    Posted 12 years ago on Wednesday September 21, 2011 | Permalink
  13. Here's the function call for the upcoming 1.6 version:

    [php]
    <?php gravity_form($id, $display_title=true, $display_description=true, $display_inactive=false, $field_values=null, $ajax=false, $tabindex); ?>

    It looks to me like yours should work.

    Can you try a hack of using the WordPress do_shortcode function?
    http://codex.wordpress.org/Function_Reference/do_shortcode

    It would only be temporary in trying to figure out why this happens.

    Posted 12 years ago on Wednesday September 21, 2011 | Permalink
  14. tinker
    Member

    I tried the following...

    <?php echo do_shortcode('[gravityform id=2 name=Help& Support Contact Form title=false description=false ajax=true]') ?>

    Still no luck and no sign of ajax in the source code.

    Posted 12 years ago on Sunday October 2, 2011 | Permalink
  15. The issue is reCAPTCHA. AJAX is automatically disabled if reCAPTCHA is present because reCAPTCHA is not compatible with AJAX. So you can't use AJAX and reCAPTCHA.

    If you need captcha you can install and activate the Really Simple Captcha plugin which adds additional options to the Captcha Field in Gravity Forms. It's an alternative to reCAPTCHA.

    This is a limitation of reCAPTCHA. Rather than the user run into a problem with the reCAPTCHA breaking, we automatically disable AJAX if it is present.

    Posted 12 years ago on Monday October 3, 2011 | Permalink
  16. tinker
    Member

    Great thanks!

    Posted 12 years ago on Tuesday October 4, 2011 | Permalink

This topic has been resolved and has been closed to new replies.