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 for submission

  1. I'm not sure why I assumed this plugin had this feature, and it was probably my mistake for assuming - but perhaps I just missed the options for it. Figured I'd ask.

    Is there support for non-page-reload submitting of forms? If not, do you plan on adding support for it? Or can you recommend a path to start going down on implementing this on my own using your hooks/api?

    Thanks,
    -Kenny

    Posted 15 years ago on Monday November 16, 2009 | Permalink
  2. Kenny,
    AJAX form submission is not currently supported. We are not sure that will make it into the core, but it would certainly make a nice add-on. If I were to implement this add-on using our hooks/API, I would do the following.
    1- Use the gform_submit_button filter to output a button that does not causes a postback, but instead calls a javascript function that will perform the AJAX call passing all the inputs in the form.
    2- Add a WP AJAX action (i.e. add_action('wp_ajax_submit_form', 'submit_form'); )
    3- In the submit_form() function, call GFFormDisplay::validate() and GFFormDisplay::handle_submission() to help you with validation and saving the data
    4- Depending on the result of validate(), display the error message or the confirmation message

    These are obviously over simplified steps, but should give you a step in the right direction. If you do decide to tackle this add-on and have some questions, I will be glad to help. You may also want to talk to Zack Katz (http://www.seodenver.com/gravity-forms-addons/) as he has been writing add-ons for Gravity Forms and AJAX submission is in the list of the ones he is interested in writing

    Thanks for the support and good luck!

    Posted 15 years ago on Monday November 16, 2009 | Permalink