How can I prevent my JotForm iFrame (embedded in Wix) from opening a new tab when submitting a multi-part form?

  • drvaishnav
    Asked on December 6, 2020 at 4:06 PM

    Hello,

    I have multiple forms. I have configured the first form to redirect to the second form (passing along relevant variables). However, when I hit Submit on the first form, it opens a new tab with the second form.

    I've tried the raw HTML code and added target=_self in the form and it still opens in a new tab and it also starts the form from scratch in the new tab.

    Alternatively, I tried embedding the iFrame version, adding the sandbox attribute and leaving out allow-top-navigation and it just resulted in a blank page after submitting.

    What JS should I be adding to configure this behaviour? Should I grab the form by the ID and dynamically add the target afterwards? I want the 302 to be within the iFrame itself.

  • Vanessa_T
    Replied on December 6, 2020 at 9:57 PM

    I just tried embedding my test form using the default iFrame Embed code and added a conditional redirect just like you have on your form, however, it did not open a new tab. The same page was redirected to the new form.

    Can you please share with us the exact URL where the form is embedded?

    May we also make test submissions directly on your form?

  • drvaishnav
    Replied on December 28, 2020 at 3:53 PM

    https://aditivaishnav.wixsite.com/inteleheart/risk-prevention-en

    This is the URL where the form is embedded. You can make test submissions on the form.

    When I tried it, the redirect ended up redirecting the whole page. However, I want the redirect to be restricted to the iFrame itself. That is, part 2 of the form should be in the iFrame and not the whole page. I don't want users to leave the website.

    I'm ok adding any custom HTML / Javascript to the original source code if needed, but I just need to know which parts to change.

  • Basil JotForm Support
    Replied on December 28, 2020 at 6:52 PM

    Hi,

    I have tested multiple ways but I cannot find a way within Jotform to redirect the user within the Iframe.

    I found this thread on StackOverflow that might help to redirect by editing the source code itself:

    Thread: https://stackoverflow.com/questions/28159920/how-to-redirect-page-inside-iframe-to-another-one-but-we-must-stay-in-iframe