473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to detect submit abort / stop button?

4
Hi all,

While I understand there is no stop button handler, I do desire a way to know if a form submission was aborted.

When I submit my page, I lock down all of the controls so no further editing is allowed. If aborted (via ESC key, stop button, etc.) I'd like the page to open again.

Is this possible?

I thought that perhaps onAbort would be called if I displayed an animated GIF but that is not the case (and rightfully so; makes sense).

Any ideas? Thanks!
Jul 3 '07 #1
10 7143
sliffy
4
Also, I was thinking there would be a way to check something in Javascript with intervals...

setInterval('someFunc()', 500);

function someFunc() {
/*
Check a property of window? document? form? navigator?
*/
}
Jul 3 '07 #2
kovik
1,044 Expert 1GB
If someone stops a form's submission, they have to deal with it, not you. You shouldn't worry about it.

If you're really concerned, don't disable the submission button.
Jul 3 '07 #3
sliffy
4
Hi V,

Much agreed.

The issue is that when the form submit is stopped, none of the data has been posted to the server and the entire form is locked down, so they have to refresh the page - losing all of their data. I have to lock down the form so that during a long submit operation, people don't edit the fields and get confused when the additional data disappears (this happens, trust me).

While you and I can easily agree (and we do) that pressing "stop" takes you out of the flow of our web apps, to users the data is still "there" in front of them - why can't I fix my mistake and press submit again?

While it pains me to say it, I'm prepared to use the document.stop handler in IE.

I spent 4 hours last night looking for a more portable solution. My only discovery was that Firefox sends the ESC key to the window so I can catch that.
Jul 3 '07 #4
gits
5,390 Expert Mod 4TB
hi ...

i think you may use ajax instead of a 'normal' form-submit. with the ajax-call you pass the data to the server and when you get the response you reenable your interface. so you have the control about the request. but i must admit that i don't know exactly whether the request may be stopped with ESC or the stop-button ... but if so you may get a response (request-status != 200) that is quite cool to handle ;) ...

kind regards
Jul 3 '07 #5
sliffy
4
Many thanks for the reply G :)

Because this form may contain a file upload (the lengthy operation which is typically aborted with the "stop" button), switching to an Ajax solution adds a lot of complexity.

I was hoping there would be and XHR-like property somewhere in window, navigator or document that I could check to see what the status of the request was.

Argh.
Jul 3 '07 #6
kovik
1,044 Expert 1GB
Basically, just don't disable the button. Sometimes, your server response is slow and if they abort and try again, it'll be faster (and most users know this). Disabling the button isn't generally a recommended practice, as it inhibits usability.
Jul 3 '07 #7
gits
5,390 Expert Mod 4TB
Basically, just don't disable the button. Sometimes, your server response is slow and if they abort and try again, it'll be faster (and most users know this). Disabling the button isn't generally a recommended practice, as it inhibits usability.
that depends strongly to the application ... and in case of using ajax-techniques it is evident to consider that option in cases where you send expensive requests (until the inerface is responsive during the request) ... exmp: send a request (may be to save something) ... in that case you disable the save-button until you get response (success or failure) ... the user notices that something happens, and you certainly dont want him to send that again ... during the first save-operation ... of course this creates 'quasi'-synchron-handling of async requests but when you have things that lasts 1 minute (and we have that here - due to processing mass-data in an intranet-application) you don't want the user to repeatedly send that request ... traffic, server-load, db-load ... etc.

so it improves usability - in such a case ...

but for traditional webapps you are right of course ...

kind regards
Jul 4 '07 #8
kovik
1,044 Expert 1GB
Actually, that would improve things on the server's end rather than the client's. As developers, we naturally care more about our servers and our bandwidth than the client does, so we're meant to protect it. However, in terms of usability, it's better to work in favor of the user rather than the server. For example, if the user was making a payment and hit the submit button twice, we'd want to detect to the extra click and submission and cancel the submission altogether rather than submit it twice.

The best thing you could do in terms of usability is make a very obvious "Processing" message displayed for the user so they are aware, but if they press the stop button, they can always retry.
Jul 4 '07 #9
gits
5,390 Expert Mod 4TB
;) i know what you mean ... but isn't it clientside usability too, when we are able to avoid double-payment through simple disabling of controls that the user shouldn't use at the moment? ... it is the same thing when we have chained menulists or something like that ... guiding the user with available actions/options.

assuming my mentioned example above: start a long, expensive request, start-it again ... they are handled parallel ... when using ajax ... every request handles the response ... may be altering something within the interface ... first request returns, or the second one ... is doing something with our ui ... later the next one returns ... probably the user worked with the ui after the first returning request ... and the second returning request handles the same things as the first one did ... and thus may be it resets the interface again to the state that the first one did. so avoiding 'double'-actions is in favour of the user ...

may be we should start a new thread on that? its getting besides the original problem ;))

kind regards
Jul 4 '07 #10
kovik
1,044 Expert 1GB
Oh, yeah, I'm not much of an AJAX user, and by "not much of," I mean "I've never tried it." Id assume that starting an operation would have the operation continue regardless of whether or not the client is still on the same page. I was thinking in terms of page requests rather than AJAX-handled requests. In that case, disabling the button would be sensible.

My way is more like, sending them to a page for the processing to occur there rather than happening on the same page.
Jul 4 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: C. Olive | last post by:
Anyone know how to hook a browser's Stop button (event?) in JS? I've looked through the Document and Window DOM events in my O'Reilly JS book and don't see anything that stands out. About the...
7
by: Gayathri | last post by:
Is there anyway to disable the stop button in IE 6? Without doing "Opening in new window and toolbar is set to no" what will document.onstop help in?? I need to capture the browser stop...
0
by: hy | last post by:
Hi all, I got the question about the radio button. How do i detect previous checked radio button after i checked other's radio button. While the new radio button checked, it need to prompt out a...
4
by: grant.griffith | last post by:
I need to find a way to force all the asp code on a web page to load regardless if the user hits the reload or stop button on the browser. I am seeing where more and more users are doing this and...
7
by: jab3 | last post by:
Hello. I'm wondering if someone can answer something I'm sure has been answered a thousand times before. I am apparently just too dumb to find the answer. :) I've found information about the...
0
by: Jay | last post by:
Hi, I have one situation where i have been stuck... its like i have two buttons on a page and what do i do is i click 1st button, which disables the 2nd button ( through Javascript ) and in...
0
by: pallavi patel | last post by:
there is a form wh having 3 frames. in 1 frame there is heading info . in 2 frame there is Menu bar & in 3 frame there is submit button. if. i click on submit button. & i rellize that some wrong...
8
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
1
by: Brian Kejser | last post by:
Hi Using javascript, is it possible to detect if the user clicks the browser stop button? Thanks
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.