Dynamically populating Gravity Forms from another form

You can now easily send Gravity Forms entry data from one form to another without adding any code! Introducing Easy Passthrough for Gravity Forms.

An often used Gravity Forms workflow is populating a form off the values of another a form. A user visits your site, fills out a form and, upon submission, they are brought to a page with another form that contains fields that they filled out on the previous page. Having the user fill out those form fields again is a very inconvenient experience.

The easiest way to do this out of the box with Gravity Forms is to add query parameters to the confirmation URL so they can be populated in the second form. However, this can sometimes be a clumsy solution as you have to manually update the confirmation each time you add a new field whose value you want brought over to the second form. It can also get out of hand if you have more than a handful of fields that need to be copied.

Luckily, there’s a simpler way to do this.

Step 1: Prepare fields for dynamic population

First, we need to prepare the fields we want to copy the values to and from to be dynamically populated.

In the form editor for both forms, select each field you want to dynamically populate and go to the Advanced tab. Within the Advanced tab, click the checkbox labeled Allow field to be populated dynamically and enter in a parameter name. The parameter name needs to be the same on both forms. For example, if you have an Email Address field on both forms whose values should be the same, set the parameter name on each field to email_address.

Step 2: Setup your confirmation

Next, we need to add a reference point to the confirmation URL to be able to retrieve the entry data.

Visit the confirmation page for your first form. Click the Pass Field Data Via Query String checkbox. In the text box below the checkbox, set the Entry ID to be passed as entry_id:

entry_id={entry_id}

Step 3: Install the Easy Form Population code snippet

Finally, insert the following snippet either into your functions.php file or as a new file that is included in your functions.php.

Before a Gravity Form is rendered, this snippet checks to see if an entry ID query parameter exists. If it does, it retrieves the entry and pass in any values whose field parameter names match.

Need to transfer entry data between forms with fields that have multiple inputs (Name field, Address field, List field)? Check out Easy Passthrough for Gravity Forms.

 

  • Marshel Sheperd

    How do I need to set up the Pass Field Data Via Query String checkbox if I have multiple things I need to pass?

    • travislopes

      You only need to pass the entry ID once in the query string for the confirmation.

      • Marshel Sheperd

        So regardless how many fields I am passing, enter in entry_id={entry_id} one time? Do i need to change entry id to the parameter name?

        • Regardless of how many fields you are passing, you add the entry ID only one time in the query string. Then, set the parameter names for the matching fields on both forms to the same name.

  • Marshel Sheperd

    entry_id={entry_id}&entry_id={entry_id}&entry_id={entry_id}

    or

    entry_id={entry_id}
    entry_id={entry_id}
    entry_id={entry_id}

  • Scott Lantz

    Thank you very much for this code. It is great for an advanced quote system I am working on. I have checkboxes in my form and the code does not seem to let me transfer any data from a checkbox field from the first form to the other. I just need the data to come over even if hidden. I have tried using paragraph, single line, and even product option type fields on the second form. Is there a fix or workaround to this?

  • Hi Travis, this post was super helpful so thank you!

    I have one form that’s accepting data from one of our service team, and then we’re passing that data into a second form that is reviewed by a professional to process an order.

    In that second form, we have some conditional logic on a few fields that essentially says if “this” field is not empty, then display this field.

    However, when we use the query link to open up the second form and pre-populate it, for some reason the second form is interpreting those fields to be empty – even though those fields are being passed data from the first.

    So the net result is that the second form is showing all of the fields to be completed, because it is not seeing the passed-through data in those fields, and thus interpreting those fields as empty.

    Is there a way to somehow ensure those fields are seen as holding data so the conditional logic triggers?

    Thanks for any help you can provide!

  • PJ

    Hi Travis. Thanks so much for this – it’s going to come in handy!
    I’m testing this out on a very short form to make sure I have the hang of it before I move on to the real forms I’ll use it on. I think I have most of it right but I’m not seeing the data populate the 2nd form. Can you tell me what I’m missing?

    Details: test form #1 has form ID10. Test for #2 is ID11. The fields are all the same as are the parameter names. (in fact, I created the form, added the parameter names and duplicated the form to be sure.)

    1. In the confirmation of form #1, I’ve selected ‘page’ as confirmation type. (I picked the page I have form #2 on)
    2. I’ve checked the ‘pass field data via query string’ and literally just left the field as: entry_id={entry_id} (I made no changes to this at all, which may be the problem?)

    I’d be very grateful for any pointers!

    • What types of fields are you trying to passthrough between forms? This script only supports fields with single inputs.

      I’m going to be releasing a plugin soon that allows for easier passthrough between forms (no setting up parameter names or a confirmation URL) and supports all fields except for the List field.

      • PJ

        Ah, that’s probably the problem. To test this I made a little form with a couple of products. Shirts and a bag. But the real form(s) are beefy with a ton products that have complicated pricing schemes. (it’s land/property/licensing stuff) My hope was to use this tool to send each field’s total dollar amount to one neat, tiddy summary form for the payment.

        Maybe I can just pass the ‘Total’ field to a new form, fashioned into an invoice of sorts, and attach the Paypal plugin to it? Do you think that would work?

        Your plugin sounds awesome, btw. I’d be all over it.

  • Jay

    Hi Travis,

    Thanks for this. I was looking for similar kind of thing but I am kind of lost when it comes to entering the entry id on the confirmation page. If you can guide or add some screenshots to your post it will be easier for newbies like me to understand 🙂

    Thanks

  • Justin Franks

    HI,
    thanks for he post, is there away i can do it in reverse. so that as data is entered into my gravity form it could populate a form on another site. ie just with email and name.

  • Kyle Morley

    Helped me out a lot, thank you!