Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-30-2007, 05:21 PM   PM User | #1
Darren
New Coder

 
Join Date: May 2005
Posts: 59
Thanks: 3
Thanked 0 Times in 0 Posts
Darren is an unknown quantity at this point
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
Darren is offline   Reply With Quote
Old 08-30-2007, 08:36 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,465
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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/
felgall is offline   Reply With Quote
Old 08-30-2007, 09:17 PM   PM User | #3
Darren
New Coder

 
Join Date: May 2005
Posts: 59
Thanks: 3
Thanked 0 Times in 0 Posts
Darren is an unknown quantity at this point
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
Darren is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:21 PM.


Advertisement
Log in to turn off these ads.