Re-enabling a disabled submit button if browser times out

F

Frank Way

Hi all,

I've googled this one to death, and still can't find an answer. Not
sure I'm asking the right question, but here goes:

Have a form with an onSubmit that has some javscript to disable the
submit button. When the user clicks submit, the value of the button
changes to "Processing..." and the button disables.

The cgi to which it is submitting will process the data and render the
next page.

During that process suppose that there is a problem of some sort on the
server and the browser times out.

Is there any way at all of detecting that in javascript and re-enabling
the submit button?

I read in an earlier post that once Submit is clicked the context is
torn down and all bets are off. Just wanted to verify that is the case.

Thanks!
Frank
 
M

McKirahan

Frank Way said:
Hi all,

I've googled this one to death, and still can't find an answer. Not
sure I'm asking the right question, but here goes:

Have a form with an onSubmit that has some javscript to disable the
submit button. When the user clicks submit, the value of the button
changes to "Processing..." and the button disables.

The cgi to which it is submitting will process the data and render the
next page.

During that process suppose that there is a problem of some sort on the
server and the browser times out.

Is there any way at all of detecting that in javascript and re-enabling
the submit button?

I don't think so.
I read in an earlier post that once Submit is clicked the context is
torn down and all bets are off. Just wanted to verify that is the case.

Thanks!
Frank

Do you have something like this?

<html>
<head>
<title>Submits.htm</title>
<script type="text/javascript">
function Submits(form) {
form.Submit.value = "Processing...";
form.Submit.disabled = true;
if (!confirm("Submit?")) return false; // for testing
return true;
}
</script>
</head>
<body>
<form action="Submits.cgi" method="get" onSubmit="return Submits(this)">
<input type="text" name="ID" size="1" value="1">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>

Your cgi script should handle the problems.
 
S

sunami

Frank,

May be I misunderstood your post, but wouldn't you get something like a
"page not found" error when the server/cgi is timed out? Basically,
the browser did not get a response from the server. You wouldn't see
the orginal form anyway.

However, if you're talking about stopping the submission (like clicking
on the "stop" browser button) ... you can try using a timer
(setTimeout) to trigger the code to enable the button, say after 1
minute or 2.

just an idea ...
 
F

Frank Way

sunami said:
Frank,

May be I misunderstood your post, but wouldn't you get something like a
"page not found" error when the server/cgi is timed out? Basically,
the browser did not get a response from the server. You wouldn't see
the orginal form anyway.

However, if you're talking about stopping the submission (like clicking
on the "stop" browser button) ... you can try using a timer
(setTimeout) to trigger the code to enable the button, say after 1
minute or 2.

just an idea ...

I'll be a bit more specific.... I really can't post any code because of
confidentiality requirements, but the specific situation involves
fail-over of redundant web servers.

The user has filled out a form on a page. They hit the submit button,
it disables, and displays the word "Processing..." Their request is
going to the server involved in the failover, and the browser actually
times out. (Haven't had my coffee yet this morning and forget the
actually message that pops up). They click "Ok" in the alert box (or
confirm box,not sure which), and are basically stuck there.

I wanted a graceful way of backing them out of that -- if possible.

I will investigate the timeout idea...that might be useful.

Thanks!
fw
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top