How to embed a prepopulated form?

  • melodicsounds
    Asked on April 7, 2016 at 6:47 PM
    how to embed a prepopulated form??? So now I need to show the preopoulated form to my user.. how to achieve this?
  • Kevin Support Team Lead
    Replied on April 7, 2016 at 7:31 PM

    When you get the code to embed the form you are provided with the link to the form as well, you only need to paste the variables the same way as you are prepopulating the URL using the direct link, if you are using the default (Javascript) embed method then your code should look like this:

    <script type="text/javascript" src="https://form.jotform.com/jsform/60977024248965?email=support@jotform.com&name=JotForm"></script>

    If you are using the iframe method then your code will look like this one: 

    <iframe

          id="JotFormIFrame"

          onDISABLEDload="window.parent.scrollTo(0,0)"

          allowtransparency="true"

          src="https://form.jotform.com/jsform/60977024248965?email=support@jotform.com&name=JotForm"

          frameborder="0"

          style="width:100%;

          height:539px;

          border:none;"

          scrolling="no">

        </iframe>

    This will work if you want to set static data, but if you want to send the variables dynamically then you will need to use some PHP code in the web page that you will embed the form, the code should look something like this: 

    Default Javascript method:

    <?php

    $email = $_REQUEST["email"];

    $name = $_REQUEST["name"];

    ?>

    <script type="text/javascript" src="https://form.jotform.com/jsform/60977024248965?email=<?php echo $email; ?>&name=<?php echo $name; ?>"></script>

    Iframe method:

    <?php

    $email = $_REQUEST["email"];

    $name = $_REQUEST["name"];

    ?>

     <iframe

          id="JotFormIFrame"

          onDISABLEDload="window.parent.scrollTo(0,0)"

          allowtransparency="true"

          src="https://form.jotform.com/jsform/60977024248965?email=<?php echo $email; ?>&name=<?php echo $name; ?>"

          frameborder="0"

          style="width:100%;

          height:539px;

          border:none;"

          scrolling="no">

        </iframe>

    You will need to pass the data over the URL and using the PHP variables, here is a sample link about it: https://shots.jotform.com/kevin/Samples/813347/test.php?email=support@jotform.com&name=JotForm

    I'm getting the variables via PHP and populating the data using the Javascript method. 

    Hope this helps and let us know if you have questions.