Create a second entry based on a checkbox

I am running a contest using GF. I want to be able to create a second entry into the contest based on conditional logic of a checkbox.

For example, this is for a Breast Cancer fundraiser and there is a contest. If someone submitting their entry to the contest chooses “Yes” next to the question of “Are you a breast cancer survivor?” we want to automatically create a second entry with their information into the form.

Is this possible?

Hi @lcibelli - that should be possible with custom PHP code. You would use the gform_after_submission hook and the GFAPI::submit_form function.

Here is the hook you will use to run your custom code:

Here is the documentation for the GFAPI::submit_form function:

With that hook and the GFAPI function, you can check to see if the checkbox was checked, and if so, run your code to submit the form again.

Or, instead of GFAPI::submit_form you could use GFAPI::add_entry function:

Read the descriptions and note the differences. If you have any other questions, please let us know.

Hi Icibelli,

Gravity Flow and it’s Form Connector extension Create New Entry step type would make this a very easy thing to setup without requiring any code. I put together a quick video that highlights where you would set the conditional logic and field mappings to avoid having duplicate emails sent or potentially creating far more than 2 entries per survivor.

1 Like

I provide the long, drawn out, hard way of approaching things, and @JamieO comes along with a simple solution from GravityFlow!

leonardo-dicaprio-clapping

Ha - Thx @chrishajer - The flexibility of the hooks and functions which Gravity Forms provides is what makes that simplicity possible.

image

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.