How to programmatically close an embedded form?

  • matt810
    Asked on July 20, 2021 at 10:26 PM

    I'm using the iframe method to display a form. I've noticed that the iframe will send a message back to the parent to adjust the height, scroll into view, enter/exit full screen, etc.

    Please add a message that is sent to the parent window when the form has been submitted. We're displaying the form within an Angular web app and want to close the iframe when the user submits. Right now, there's no mechanism to do this, but it wouldn't be hard to do on your end.

    We don't want our users to continue our workflow until we can detect they've filled out the form. And if we can't find a suitable workaround, we may consider a different product.

  • Niko_N
    Replied on July 21, 2021 at 6:42 AM

    Greetings,

    Unfortunately, currently, there's no direct option for that. However, you can use the full source code of your form and add any desired custom codes to get the desired outcome:

    How to Get the Full Source Code of Your Form

    Thank you!

  • matt810
    Replied on July 21, 2021 at 4:02 PM

    Thanks for the response. Although we get a lot of control with the source code, the issue we have with this option is that we'll have users updating forms on Jotform.com website. But with any change they make, we'll need to re-download the html/js/css of a form and repackage it with our Angular app.

    From a maintenance perspective, this isn't feasible.

    Do you have any thoughts on this?

  • Welvin Support Team Lead
    Replied on July 22, 2021 at 1:45 AM

    The thank you message is displayed when the form is submitted. Are you trying to stop people from reloading the same frame or going back in the frame to load the form again?

    How about redirecting users to a different page when they submit the form? Would that work for you?

    https://www.jotform.com/help/38-redirecting-users-to-a-different-page

  • matt810
    Replied on July 22, 2021 at 5:44 PM

    This may partially work. I've done a small test, but it seems that the redirect occurs for the entire page, and not just the iframe itself. Is it possible to dynamically set the callback url with the iframe? The response page will be unique for each user.

  • Welvin Support Team Lead
    Replied on July 22, 2021 at 6:48 PM

    Yes, it will be an entire page regardless of the embed codes. I'm sorry, but you may opt to create a conditional logic instead to redirect users to a different thank you URL based on their answers.

    https://www.jotform.com/help/317-change-thank-you-page-url-based-on-a-condition