Prepopulating another jotform

  • dorsetholidaylets
    Answered on November 10, 2014 03:50 PM

    Does this only work with the Jotform Thank you Page or can you create forms which populate another and use IFrame to add both forms to my web site.

    I rather not use the Jotform Thank You page but use a Customized page on my web site.

  • Ben
    Answered on November 10, 2014 05:02 PM

    Hi David.

    Yes, you can prepopulate the other jotform. What you need to do is change the thank you page to point to your other jotform and attach parameters to it.

    You can see it in action here: http://www.jotformpro.com/form/42912153930955

    It will show you prepopulating using Full Name tool and the regular text box when it takes you to a new jotform.

    If you would like to inspect it you can by cloning it to your account: How to Clone an Existing Form from a URL

    This guide will show you where to setup a link to your other jotform Redirecting Users to a Different Page

    and the link is created as on the page you have asked the question on, but if you are in doubt or something just does not click the right way, let us know and we will be happy to help.

    Best Regards,
    Ben

  • dorsetholidaylets
    Answered on November 10, 2014 06:33 PM

    Hi, I have got the prepopulating to work between two forms but only as pages within Jotform not when both pages are embedded using Iframe. 

    I am able to embed the first form on my web site using IFrame and link it to the jotform 2nd form using the thank you message , but how can I embed the 2nd form in my web site and still populate fields from the first. I tried adding the populate code to the jotform Iframe code (i.e. ?email4={email3}) but it did not work.

     

     

  • Charlie
    Answered on November 10, 2014 08:36 PM

    Hi,

    I'm not sure if I understand it correctly. But this is how I see it:

    1. You have 2 forms embedded on your website.

    2. You fill out form1 and send the values directly to form2

    3. Your form2 embedded in your website should be prepopulated by then.

    I have a workaround in mind, but it might be quiet lengthy. See the guide below.

    Brief description of how my suggested workaround will do, we will make form1 to be able to sent its data values to a .php script on your website (ex. contact.php, in my demo it will be iframe_populate.php). The contact.php is also the page to where we will embed our form2 using iFrame, the .php script will receive the value and prepopulate the form2 using the iFrame rather than a direct custom form URL.

    1. Make form1, mine is named Prepopulate_PHP_Part1

    Prepopulating another jotform Image 1 Screenshot 60

    2. Navigate to Preferences and enable "Send Post Data"

    Prepopulating another jotform Image 2 Screenshot 71

    3. In your custom "Thank You" age wizard, paste the link of the webpage to where you want to embed the form2. This is my sample website with specific webpage to where I want my form2 to display https://shots.jotform.com/charlie/iframe_populate.php 

    Prepopulating another jotform Image 3 Screenshot 82

    4. Create form2, in my case it is named "Prepopulate_PHP_Part2, this is the form that I will embed on my php script on my website.

    Prepopulating another jotform Image 4 Screenshot 93

    5. This is what my iframe_populate.php script would look like.

    <?php 

    $answers = $_POST;

     $var1 = "?name2=".urlencode($answers[name]);

    ?>

    In my iframe code, the attribute "src" is like this:

    src="//form.jotformpro.com/form/43137809775970<?php echo $var1; ?>"

    Lightblue Highlight: This captures the data submitted by form1.

    $answers = $_POST = transforms the captured data into an array, ex. form1 has name.

    $var1 = we store the field value of name from form1 to this.

    ?name2 = is the name of the field in form2.

    Dark blue highlight: the src link in my form2 iframe code.

    Pink highlight: this function prints the value of $var1 to the src link making it a prepopulate field. 

    Prepopulating another jotform Image 5 Screenshot 104

    You can see my live form here:

    Form1: http://form.jotformpro.com/form/43137218703955 

    Form2 Embedded on webpage: https://shots.jotform.com/charlie/iframe_populate.php 

    If you would like to embed form1 to a different page, that would also have the same effect.

    You can find the detailed guide for PHP Post Data here:

    http://support.jotform.com/help/213-Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page 

     

    This is quite lengthy, but I hope this helps you or at least give you an idea. If you need further assistance, feel free to contact us.

    Thank you.