iFrame with Dynamic URL Based on URL Parameter

  • SportsForm
    Asked on April 23, 2016 at 2:14 PM
    4) I want to embed an iframe with dynamic url into jotform, is it possible?
  • Charlie
    Replied on April 23, 2016 at 2:55 PM

    May we know more what you would like to accomplish here? I presume you needed to change the source URL in the <iframe> element?

    If you want to embed an iframe element in your form, that is possible using our iFrame Embed widget. You can also embed it on the "Text" field, it allows HTML code to be injected there.

    Here's a screenshot showing the "Text" field in our form builder.

    iFrame with Dynamic URL Based on URL Parameter Image 1 Screenshot 20

     

    However, as mentioned on this other thread link, PHP and Javascript codes cannot be added on the form using our form builder, but can be done if you'll use the form's full source code. I presume what you want to do is to dynamically change the source URL in the iframe element based on some conditions? If that's the case, you might need to use the full source code then.

  • SportsForm
    Replied on April 23, 2016 at 11:49 PM

    Hi Charlie,

    I want to set a placeholder in the iframe element in a jotform, when it's launched, I can replace that placeholder with an url that's passed through request params.

    Example: https://form.jotform.com/123456890?url=http%3A%2F%2Fmysite.com%2Fthank-you

    Regards,

  • Chriistian Jotform Support
    Replied on April 24, 2016 at 1:42 AM

    Hi,

    As my colleague suggested, you can add iFrame Embed widget to add iFrame to your form. Unfortunately, the src of the iFrame cannot be changed dynamically based in URL parameter. However, if you have some knowledge using PHP to get URL parameters, you can use PHP in your own page and you can add your form on that page using its form source (How to get the Full Source Code of your Form)You can then manipulate the src of the iFrame in your form using PHP.