How to prepopulate embedded form with variable

  • Profile Image
    Asked on January 12, 2018 at 08:27 AM

    I would want to populate a parameter in my form from a variable I calculated in a js, i.e. like this

    <script type="text/javascript">
    var MyParam=function().param('data');

    resulting in MyParam containing a data string.

    For a lightbox form I found that I could populate my form like this:

    <script src ="" type="text/javascript">
    <script type="text/javascript">
              var JFL_80112205327341 = new JotformFeedback({
              formId: '80112205327341',
              base: '',
              windowTitle: 'Parameter Test',
              iframeParameters: {
                  'parameter':  MyParam
              background: '#FFA500',
              fontColor: '#FFFFFF',
              type: 'false',
              height: 500,
              width: 700,
              openOnLoad: false
    <a class="btn lightbox-80112205327341" style="margin-top: 16px">
      Parameter in Lightbox Form

    However, I cannot use a lightbox, but need to use a regular embedded form, which I would normally call in html with

    <script type="text/javascript" src=""></script>

    But instead of the static 12345 I would need to have the dynamic MyParam

    Any ideas?

    Thank you

  • Profile Image
    Answered on January 12, 2018 at 10:09 AM

    Yes its possible to prepopulate a form with a URL parameter.

    Please try using this tool. It makes it very easy to generate the URL you require.

  • Profile Image
    Answered on January 12, 2018 at 10:26 AM

    Thank you, but that's not answering the question, I'm afraid.

    I do know how to populate fields from an URL with _static_ parameters. However, I would need to do so using a _variable_ that I dynamically create in a javascript first.

  • Profile Image
    Answered on January 12, 2018 at 11:11 AM

    I created a demo that uses a HTML form. On submission it reloads the page, passing the parameter to the form.


    Copy and paste the code into an empty text file.

    And save it as "reload.html"

    The code looks like this:

    <!DOCTYPE html>





    <script type="text/javascript" src=""></script>


    <form action="reload.html?data">

      First name:<br>

      <input type="text" name="data" value="Mickey">



      <input type="submit" value="Submit">





    I guess you could create a JavaScript version of this idea?

    1515773291Mozilla Firefox_004.png