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