Sending field data from two different forms on the same site to one email

  • jnguyen31
    Asked on November 11, 2016 at 10:53 PM

    I have a form on my homepage that collects name and email. When they submit the form it takes the to the next page with a different form that collects address and phone number.

    Right now Im getting two email notifications. One for the data fields for the homepage form, and another email for the form on the next page.

    Is there a way for me to have the data on the homepage form (hidden) to pass through to the second page's form, and when they click submit on the second page I'd like to have all the data fields from both forms sent to me in one email?

     

    Example:

    1. visitor goes to domainA.com - form1, clicks submit

    2. they land on domainA.com/getstarted - form2, clicks submit

    3. I only get one email with data fields from form1 AND form2 

    Thanks

  • Mike_G JotForm Support
    Replied on November 12, 2016 at 9:59 AM

    Yes, there's a workaround that you can do to meet your requirements.

    First, in Form 2, the one in the "Next Page", add a Name field and an Email field.

     

    Sending field data from two different forms on the same site to one email Image 1 Screenshot 50

    Then, in Form 1, we need to make sure that when it is submitted, the respondents will be redirected to the "Next Page".

    To learn how to redirect your users to a different page after successfully submitting your form, please check this guide: https://www.jotform.com/help/38-Redirecting-Users-to-a-Different-Page

    Sending field data from two different forms on the same site to one email Image 2 Screenshot 61

    Next, we need to make sure that the data (Name and Email) in Form 1, that is on your Home Page, will be passed to the fields of Form 2 on the Next Page. We will use URL parameters to pass the data.

    You may find the guides below also helpful.

    https://www.jotform.com/help/71-Prepopulating-Fields-to-Your-JotForm-via-URL-Parameters

    https://www.jotform.com/help/351-How-to-Automatically-Pass-Form-Data-to-Another-Form

    We need to get the "name" of the new "Name" and "Email" fields from Form 2.

    You can do that by loading Form 2 and "Inspect" it (CTRL+SHIFT+I or Right-click and select inspect from the context menu).

    Sending field data from two different forms on the same site to one email Image 3 Screenshot 72

    In the image above, you see that we have "q5_name[first]" for the "First Name" in the Name field and "q5_name[last]" for the "Last Name" then "q6_email" for the "Email" field. However, in the instruction in this guide, https://www.jotform.com/help/71-Prepopulating-Fields-to-Your-JotForm-via-URL-Parameters, it is mentioned that we only need to copy the "name" after the underscore symbol "_".

    In this case, we will have "name[first]" for the "First Name", "name[last]" for the "Last Name", and "email" for the "Email".

    The last thing that we need to do before we construct the link that we need to place in the Thank-You wizard of Form 1 is to find the "{uniqueName}" (data) of the fields in Form 1 that we need to pass to Form 2.

    In order for you to find that, please follow the instruction in this guide: https://www.jotform.com/help/146-How-to-find-field-IDs-and-names

    Note: Since there are two fields that are included in the "Name" field (first and last fields), the {uniqueName} are as follows:

    First Name will be {name:first}

    Last Name will be {name:last}

    and

    Email = {email}

    Once you already have those, you can now construct the link to the Next Page that will be placed in the Thank You wizard of Form 1.

    https://shots.jotform.com/MikeG/mikeg/nextpage.html?name[first]={name:first}&name[last]={name:last}&email={email}

    This is how the link to the Next Page is structured:
    Blue highlight: This is Next Page's direct link
    Red highlight:
    "?" - We will start the pre-population by adding this symbol first.
    "=" - To assign a value to a form field
    "&" - To  add more than one form field to be prepopulated
     
    Yellow highlight: This is the "name" of the fields from Form 2.

    Green highlight: This is the {uniqueName} of the fields from Form 1.

    Sending field data from two different forms on the same site to one email Image 4 Screenshot 83

    Below is a link to my sample Home Page where my sample Form 1 is embedded: https://shots.jotform.com/MikeG/mikeg/homepage.html

    You can try to submit the form to test it. I have added an Email Autoresponder to my sample Form 2, so you will also receive an email once you submit it.

    With regards to the Email Notification since you only want to receive it when Form 2 is submitted, I suggest you just delete it from Form 1 and make sure you update the one in Form 2.

    I hope this helps. If you need any further assistance regarding this, please feel free to contact us anytime and we will be glad to help.

    Thank you.

  • Mike_G JotForm Support
    Replied on November 12, 2016 at 10:08 AM

    I would like to apologize, I forgot to mention that you can hide the Name field and the Email field in form 2. I just didn't do that in my sample Form 2 to show the data being transferred.

    Sending field data from two different forms on the same site to one email Image 1 Screenshot 20

  • jnguyen31
    Replied on November 12, 2016 at 11:06 AM

    Fantastic Mike! Thanks!

  • Nik_C
    Replied on November 12, 2016 at 6:41 PM

    On behalf of my colleague Mike, you're welcome!

    Let us know if you need any additional assistance.

    Cheers!