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.

A Method for Submitting Forms via Ajax

  1. I've seen that a few people are looking to do ajax form submits and at least one guy is working on a plug-in to accompany Gravity Forms to do it. Here's a quick solution with some code you can stick in your theme's functions.php file to make any Gravity Form ajax-ified. http://newportcreativegroup.com/blog/2010/07/27/gravity-forms-submit-via-ajax/

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  2. Very cool. We will be adding AJAX capabilities to Gravity Forms in the future but this is certainly a usable stopgap option until we do.

    When we implement it we will do so as an option on the shortcode and function call when you display the form (similar to title and description true/false). It won't be a form setting, but an option when you call the form.

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  3. Great, looking forward to that.

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  4. Couple things to note on this AJAX, there are some features that may have a problem working properly with it such as reCAPTCHA and File Uploads. Standard forms should work fine but some features such as these may have problems with this implementation.

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  5. I don't think file upload or recaptcha will work with this. It will work with all Standard Fields and all Advanced Fields other than those two. Haven't tried it at all with Post fields yet. Stuck a demo on the post on my site so you can see how it works: http://newportcreativegroup.com/blog/2010/07/27/gravity-forms-submit-via-ajax/

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  6. You spurred our lead developer on and he already has AJAX working with the file upload fields and it's looking like AJAX will be built in as an option in the 1.3.14 release.

    It won't, however, work with the reCAPTCHA field. So what will happen is you won't be able to use AJAX if you are using the reCAPTCHA field. Because of this we are going to add an anti-spam honeypot option as a form setting so you can use a honeypot instead of reCAPTCHA.

    An official widget will also be part of the 1.3.14 release.

    Posted 10 years ago on Tuesday July 27, 2010 | Permalink
  7. rochow
    Member

    Is there an ETA on the release of 1.3.14? I used newports code (thank you!) which works for errors, but I'll have to figure out a way to hack the success message in via AJAX too.

    I know some clients who HATE ajax (for no logical reason just personal preference, but still!) so a toggle the same as HTML5 and CSS would be perfect.

    My situation is on a lower part of a sidebar, they have a "subscribe to our newsletter" form, just name and email, so not having ajax is REALLY bad - any error you just see a page reload at the top, and success goes to a new page... simply sitting at the same spot and showing a red error or a green success (hiding the form if successful) is much more intuitive. I have another site with a decent size form at the bottom of the page and it's the same thing - any errors appear to just reload the page at the top, and because the form is out of sight, it's confusing as to whether it worked or didn't work.

    I've implemented the workaround by newport for now but am pretty desperate for this new feature, I use forms a few times a day, every day per week... eats lots of time using the workaround :-)

    Posted 10 years ago on Monday August 9, 2010 | Permalink
  8. 1.3.14 will be released as a beta later this week. So keep watching the support site for an announcement.

    AJAX will be an option when using the shortcode or function call. It won't be a toggle like HTML5 and CSS in the admin, it will be something you declare when you call a form. So it can be turned on or off per form output.

    Posted 10 years ago on Tuesday August 10, 2010 | Permalink
  9. rochow
    Member

    Sounds good.

    Another thing I've been wondering, when I add a default value, is there an option to have it clear on focus? I do quite a few forms where that's the case, I'd rather do it as part of the form then in my external JS file.

    Posted 10 years ago on Wednesday August 11, 2010 | Permalink
  10. Hi Rochow, this should do the trick for you: http://www.gravityhelp.com/clearing-default-form-field-values-with-jquery/

    Posted 10 years ago on Wednesday August 11, 2010 | Permalink

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