What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Prevent users from navigating away from form

    Asked by bishopfarm on March 29, 2017 at 06:39 PM

    Is there a way for me to block users from navigating away from the form? On a mac for example it is easy to do a two finger swipe to the left and go back to the previous page (losing all the info entered on the form). This is normally done through a beforeunload. I would rather have this as a form option other than having to tweak with custom javascript myself. My understanding is that tweaking the JS manually does not work nicely if I them modify the form template somehow.

  • Profile Image
    JotForm Support

    Answered by jonathan on March 29, 2017 at 09:32 PM

    If your form was published on a website page, you will need to add your own custom javascript on your website that will do this function.

    But if you will only be using your form URL, there is no way to achieve this. Because it requires injection of javascript code that will do this function.

    You can apply it using your form source code, but it will still require you to have your own hosted page if you will use the form source code.

    I found on the internet such javascript code function that do such action. Check it here 

    http://stackoverflow.com/questions/821011/how-do-you-prevent-a-webpage-from-navigating-away-in-javascript

    Let us know how we can be of further assistance.

     

     

     

     

  • Profile Image

    Answered by bishopfarm on March 30, 2017 at 02:04 PM

    Yes you basically posted the same link I did. Would it be possible to add this feature to the form? Seems like a basic thing to have...

  • Profile Image
    JotForm Support

    Answered by Jim_R on March 30, 2017 at 03:44 PM

    As of now, there's no way to have this feature added within the Form Builder. The only way around this is to go with my colleague's suggestions:

    1. Grab the Full Source code of your form

    2. Use it to embed the form on your website

    3. Then use the script from the Stackoverflow discussions cited (by you or by my colleague)

    In case you need more help, just let us know.