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 not working - also getting error with chosen dropdowns

  1. Hi there,

    I've been playing for hours, trying to figure out exactly what is happening with my form. Ajax form submission just refuses to work!

    I have tried both manually calling (with a call to gravity_form_enqueue_scripts above the wp_head() function), and inserting a shortcode into a Page (both manually and using the button) - no dice.

    I have NO plugins active, and am using the TwentyEleven default theme...

    It also seems to be doing the same thing when going to Preview (Ajax isn't working, the whole page reloads).

    Also, as a side-effect, the beautiful dropdowns (chosen) seem to revert when the form is submitted and an error occurs (Error: jQuery("#input_2_4,#input_2_11,#input_2_10").chosen is not a function Line: 22). Strangely, this doesn't occur in the Preview...

    I've also tried with Chrome, Firefox and IE (clearing cache).

    Any ideas? I'm stumped!


    Posted 10 years ago on Thursday November 10, 2011 | Permalink
  2. The form preview in Gravity Forms doesn't use AJAX, it uses a standard form submit. The AJAX option isn't used, it's only an option on the shortcode and function call.

    While I do see the error you were referring to regarding the chosen script, I was able to submit the form on that page just fine without any problems. Here is a screenshot showing the form just after I submitted it:

    The chosen script error appears to only occur when there is a validation error. We will look into that.

    But as far as the form on the link you provided, when I go right to your page, enter the Name and Email and submit the form it appears to be working just fine. The AJAX subit appears to be working as intended, I don't see any problems with it. You can view the entries for that form and you'll see my test entries.

    Are you not able to submit it?

    Posted 10 years ago on Thursday November 10, 2011 | Permalink
  3. Hi Carl,

    Thanks for the speedy relpy! Sorry, i did forget to mention that - it does indeed submit the form (I got the two emails you were testing as well). I just wasn't sure if the form was indeed being submitted via Ajax or not.

    Most of my testing has been around the form validation, where if you submit the form, the whole page reloads (at least it seems like it to me), and the chosen script seems to mess up, which is rather annoying!

    I'm guessing this is an issue with the plugin itself? I'll make use of the standard dropdowns until its fixed.

    Thanks again for your help!

    Posted 10 years ago on Thursday November 10, 2011 | Permalink
  4. The form on the page you provided the link to is indeed loading with AJAX. You can tell it is AJAX because when you submit it, you will see a spinning icon next to the submit button which is the AJAX posting to the server. So that form is using AJAX.

    When validation is triggered on that form the page does not reload. What is happening is when a validation error occurs, the form focuses on the location of the first error. This is by design. If Gravity Forms didn't move focus to the location of the first validation error, the user would be left at the bottom of the form and it would not be obvious that an error occurred.

    So the page isn't reloading, the page is just anchoring to the location of the first validation error so that the user can easily correct the issue and then resubmit the form.

    The form is working as intended and is utilizing AJAX.

    As I already mentioned above, the issue with the chosen script is a bug. The script isn't getting loaded when a validation error is triggered. We'll correct that in the next release.

    Posted 10 years ago on Thursday November 10, 2011 | Permalink
  5. Ah, i see. Thanks for your help!

    Posted 10 years ago on Thursday November 10, 2011 | Permalink

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