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.

Multiple forms with gform_after_submission

  1. Hi!

    I have a wordpress site with multiple events and every event has a different form. I need to send the email address to another database with an API. I used the gform_after_submission function, its working fine, but heres the problem:

    I need to send 3 values with the API, email address, first name and last name. I can request these with the entry object, like $entry["1"]; for the email address and $entry["2"]; for the first name, however, because i have multiple forms, these IDs might be different and i don't want to create the same function for every form.

    Any idea how can i make this easier?

    Posted 9 years ago on Saturday September 8, 2012 | Permalink
  2. It would be simplest if the field ID was the same between all forms, then you don't need to do anything specific to make this work.

    Take a look at this example which was written by David Smith. It uses a class format, and then you call the class with additional parameters and in your class you call the gform_after_submission. http://gravitywiz.com/2012/06/11/limiting-how-many-checkboxes-can-be-checked/

    Even if you don't go with a class, you need a way to send your function the additional information (the field IDs) it needs. David did it pretty cleanly in that example at gravitywiz. Let us know if you need any more ideas.

    Posted 9 years ago on Sunday September 9, 2012 | Permalink