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

    Is it possible to trigger a download by clicking a Submit button?

    Asked by BWG on January 23, 2015 at 07:06 PM

    I know that we can link to a file for downloading by choosing it as a custom "thank you" page, but what I would love to be able to do is to take the visitor to a "real" thank you page and initiate a file download at the same time, by clicking a "Submit" button.

    Is there any way of doing that?

    Vlad

    Page URL:
    http://businesswriting.com.au/a-test-page/

    trigger love same and file download
  • Profile Image
    JotForm Support

    Answered by Charlie on January 23, 2015 at 10:02 PM

    Hi Vlad,

    I believe this is possible if you will be using javascript to your thank you page url.

    Here's a guide on that: https://www.jotform.com/help/89-Create-a-Custom-Thank-you-page-with-Auto-redirect. But this is more of a redirect.

    Here's a quick guide on how to have a thank you page and have a download redirect.

    1. Here's the code for the thank you page url.

    This is the javascript code:

    <script type="text/javascript">

    var timer = 3; //seconds

     website = "https://shots.jotform.com/charlie/Test.pdf"

    function delayer() {

     window.open(website, '_blank');

    }

    setTimeout('delayer()', 1000 * timer); 

    </script>

    2. I then added it on a thank you page url.

     

    Here's the demo form: http://form.jotformpro.com/form/50228522520949

    You can further advance this process but we'll need to further our coding skills. Do you want to directly download the file without our browser blocking it as a pop-up?

    I hope this helps or at least gives you an idea on how to proceed. Let us know if you need more assistance.

    Thank you.