How to pre-populate a text field with data from another part of the webpage where the form is embedded?

  • ptn0301
    Asked on April 30, 2014 at 12:09 PM

    Hi

    I am trying to pre-populate a text field of a form with data from another part of the page where the form is embedded.??

     

    Its simple a VRM no. of the product the form is on. Is this psossible.

     

    Thanks in advance

     

    Pics attached.

    Jotform Thread 369937 Screenshot
  • ptn0301
    Replied on April 30, 2014 at 3:36 PM

    thanks for your help much appreciated. any problems and I will let you know.

  • ptn0301
    Replied on May 1, 2014 at 5:10 AM

    Hi

     

    Im not quite there.... This from is embedded in different pages with different reg numbers. Does this mean I have to add the code to each page? Or is there a way for the form to read the page its in and pick up the reg no. ??

    We need the form to pick up the VRM - [*******] on each page the from is generated? Maybe I wasn't clear enough...sorry.

    Thanks

     

  • abajan Jotform Support
    Replied on May 1, 2014 at 7:50 AM

    That can be done but there's no way that I know of to accomplish it with the iFrame version of the form code. As such, in each page you would need to substitute the form's full source for the iFrame and add a script to prepopulate the Reg. No. VRM textbox with the VRM. Moreover, in order for the script to pull the VRM information from the page it may be necessary to add an ID to the VRM element. (There might be a way around this particular obstacle though.)

    Depending on the number of vehicle pages on your site, the above procedure could be quite time consuming. Let me see what I can come up with and get back to you.

  • abajan Jotform Support
    Replied on May 1, 2014 at 10:37 AM

    Hi again,

    As previously mentioned, in each page you'll need to replace the form's iFrame code with its full source. After doing so, insert this code anywhere after the form code.

    Unfortunately, as mentioned in the guide, the disadvantage with using the full source is that each time you change anything in the form in the form builder (except for email alerts), you'll need to replace every instance of the form with the updated code from the Embed Form Wizard. With your site that can be quite a bit of work. So, it would be best to ensure that the form's design and functionality is as you wish before embedding it in each of your website's pages.

    If you need further assistance with this, please let us know.


    Thanks