Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    59
    Thanks
    3
    Thanked 0 Times in 0 Posts

    How do I cancel a form submit that is in progress?

    I have a form that uploads a file and pops up a progress meter (I use setInterval() to run the monitor process). In the meter, I'd like to have a cancel button. So let's say the file takes a whopping 10 minutes to upload and at about minute 5 the user decides to hit the cancel button and terminate the upload. How do I instruct the form to stop uploading the file, or is this not possible?

    Darren

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,633
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Most browsers have a button on the toolbar for that. It is usually labelled "Stop" or is red with an X in it. There is no way to do it from JavaScript until after the next page has loaded sufficiently to load the code for that option by which time the upload will have finished.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    New Coder
    Join Date
    May 2005
    Posts
    59
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Well, in that case my question becomes, how can my progress meter (running via setInterval()) know that the user has hit the cancel (red x) on the browser toolbar? Because I'd hate to have the user hit that red x up there, and leave the progress meter (a dhtml dialog) up.

    Darren


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •