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.

Tutorial: Two-stage form with data passed by query string

  1. lcooper1784
    Member

    I recently attempted to implement a two-stage form for a website, and after much frustration and several emails back and forth with the wonderful Gravity Forms support team, I finally overcame the learning curve and got it working correctly. I thought I would share the process for others who might be attempting to accomplish the same goal.

    The Goal: A two-stage signup form for the company's email newsletter. Divided between two separate forms, users would enter only their email address into "Form 1," located in a widget in the header, and upon hitting "submit" they would be taken to the full signup form ("Form 2") in which they would enter the rest of their information. The email address they entered in Form 1 would be dynamically passed to Form 2.

    Note: This process could be adapted to whatever usage necessary. I am merely describing the (somewhat complicated) process of setting up this system. This tutorial is aimed at those who use gravity forms, but do not have an advanced or thorough understanding of query strings or other such technical mumbo jumbo.

    The Process:
    1. Create the first form (Form 1), including whatever fields required. In my case Form 1 included only an Email Address field.
    2. Save Form 1
    3. Create the second form (Form 2), and include desired fields, including any duplicate fields from Form 1. In my case, Form 2 contains an Email Address field as well.
    4. Save Form 2
    5. Place Form 2 in a page and copy the URL of where the form will be located on your site.
    6. Return to Edit Forms and select Form 1
    7. On the Confirmation tab select "Redirect" and paste or type the URL where Form 2 is located into the box.
    8. Check the box next to "Pass field data via query string"
    9. In the text box that appears you will enter the parameter name of your choice, followed by an equal sign, then the merge tag of the field whose data you wish to pass (selected from the drop down menu). So in my case I entered: email={Email Address:1}. The first time around I had entered "Email Address" as the parameter name and it did not work. The parameter name is simply a method of identification between the two forms. As long as it matches between form 1 and form 2, it does not have to be the same thing you entered in the Field Label box for a given field. As shown in the sample below the text box, you can define more than one set of data to be passed by including an & between the sets (name={Name:1}&phone={Phone:1})
    10. Save Form 1
    11. Return to edit Form 2
    12. Select the "Advanced" tab of the fields you wish to be dynamically populated (In my case, Email Address). Select "Allow field to be populated dynamically" and enter the parameter name you defined in Form 1 (In my case, "email"). This tells the form to apply whatever data is associated with that parameter name to that field.
    13. Make any final edits of your forms and test!

    When you fill out form 1 and then click submit, the page should redirect to the location of form 2, and the data entered should appear in the appropriate fields. You will see the information in the URL, for example: http://www.yoursite.com/page-path/?parameter=value.

    Troubleshooting:
    1. If the form does not redirect correctly, double check the accuracy of the URL in the redirect box of Form 1. The best way to avoid error is simply to copy / paste the permalink provided by wordpress when you create a page or post.

    2. If the data does not pass between the forms, double check that your parameter names match exactly between the field sets: Email Address (Form 1) parameter name = email (defined in the "Pass field data via query string" box. Make sure that you didn't accidentally include a space after the parameter name, and ensure that your capitalization is the same.
    Then verify that the parameter name matches in the "Parameter Name" box of the corresponding field in Form 2.
    Also make sure that you have selected the correct merge tags when defining your parameters!

    I hope this proves useful and helpful for those less-than-technical folks out there like me :)

    Posted 12 years ago on Thursday January 26, 2012 | Permalink
  2. I tried to follow your steps but get lost. My forms are all one constant form separated by page dividers. I am using the plugin cart66 and doing a manual checkout, but when the checkout page appears none of my clients previous contact info that was input on the first page has transferred over. Can you help?

    Posted 12 years ago on Sunday February 5, 2012 | Permalink
  3. lcooper1784
    Member

    This process does not apply to data from one form divided over multiple pages using the page divider function. In that case it is still one form simply broken up over several pages. It sounds like the guys at GF will have to help you with your particular issue. My tutorial was designed for those who need to pass data dynamically between separate forms. So sorry!

    Posted 12 years ago on Sunday February 5, 2012 | Permalink
  4. Nice post! Thank you so much it worked for me. Had to figure out that I had to look for the field name in the drop down list for the "insert merge tag" and made sure I had the "=" sign. IE city1={cityformtwo:2}

    Posted 11 years ago on Sunday June 10, 2012 | Permalink
  5. I just discovered if I use a parameter name such as "name" I keep getting a 404 redirect. IE
    name={frank:1} but if I put a "1" on the end such as name1={frank:1} (or any digit I suppose would work) why does it work? Is using "name" part of the coding language and messing things up?

    Posted 11 years ago on Monday June 11, 2012 | Permalink