Close form after submitting, using iframe

  • ric_aguiar
    Asked on August 8, 2019 at 9:51 PM

    Hello,

    I am embedding a form in an Android application. I'm using iframe. The problem is that after the thank-you screen, the form is still open, and when I click back the form opens again. Could someone help me insert a function into iframe to "kill" the form after the thank-you screen? If this is impossible, I accept any creative suggestion that might give a similar result.

    Thank you!

  • AshtonP
    Replied on August 8, 2019 at 10:29 PM

    I tried to search an answer for this however could not find much relevant information on the web. 

    Can you implement conditionally redirecting users to thank you page feature within Jotform? This should help you redirect the user's to any page within your app when they submit the form.

    Here is the Guide: https://www.jotform.com/help/317-Change-Thank-You-Page-URL-Based-on-a-Condition

    Let us know if this suits your requirement.

  • ric_aguiar
    Replied on August 8, 2019 at 11:22 PM

    Hello,

    Thank you very much for your reply. Your suggestion is good for most cases, but in my case it won't work. If I enter a thank you page URL, at the end of the form a web page will open (chrome, etc) and the user will be taken out of my application.

    Currently, when I finish the form (thank you page) and click to go back, it immediately loads the form again (going into an endless loop)

    I'm pretty sure there is no way to do what I need inside the JotForm form editor. So my hope is to include some function in the iframe code that "kills" the form's own iframe, or prevents it from opening itself by clicking back (looping). It would basically take JotForm's embed code and change it.

    If anyone makes this possible, I will certainly make a donation to him.

    I really need this function to finish my app.

    Many thanks to all for your attention.

  • Richie JotForm Support
    Replied on August 9, 2019 at 12:38 AM

    Another method is to redirect to the URL page that have a script on load event that will automatically close the browser window when loaded.

    This is not guaranteed to work since most browsers tend to block scripts that are automated.

    The script should be something similar to what was described here.



  • ric_aguiar
    Replied on August 9, 2019 at 1:19 PM

    Thank you for your reply. I need a solution that doesn't use the "redirect to URL page" option as this would make the app call the client browser (even if the browser was immediately closed). I need to include in the html script a function to close the iframe after submitting the form, or prevent the form from reloading when it is clicked back.

    Thanks so much everyone is trying to help me.

  • Richie JotForm Support
    Replied on August 9, 2019 at 1:34 PM

    Kindly check this link for scripts that may help you with your requirement.

    https://stackoverflow.com/questions/1631959/how-to-capture-the-browser-window-close-event?lq=1

    Do note that this is not guaranteed to work since most browsers tend to block scripts that are automated.

  • ric_aguiar
    Replied on August 9, 2019 at 2:22 PM

    Thank you for your reply. I have tried some of these scripts, but they seem to be very old and incompatible with current browser versions. Anyway thank you for your commitment to help, I will continue looking for a solution.

    Thank you.