Got a Javascript question:

I'm developing a bit of code that allows a user to trigger an action on my
server that may take up to a minute to complete (a large database insert). I
want to prevent my user from clicking the "submit" button more than once,
because if they *do* click it more than once their data may end up being
inserted more than once.

I'm thinking that I can use javascript to reduce the likelihood of this
happening. My users will almost all (99%?) be using version 4 browsers, but
they could be using either NS or IE. I'm thinking that I can have a
javascript "confirm" come up when they click the submit button, asking them
"are you sure", then when they click it the form will actually be submitted.
Ok so far, but when they click OK in the javascript confirm box, the form
data gets posted to the server, but the current page sits there until the
action is completed on the server and the server sends back the results
page. This means that the submit button is still sitting on the user's
screen, which means that they *could* click it again, despite the WARNING I
put in red right next to the button.

Is there a way, with javascript, to maybe disable the submit button after it
has been clicked? Or should I just try to arrange my backend Cold Fusion
scripting so that it sends back something to replace the contents of the
browser window *before* the big process on the server is done?

Ideas?

TIA,
Jack

____________________________________________________________________
--------------------------------------------------------------------
 Join The NEW Web Consultants Association FORUMS and CHAT:
   Register Today at: http://just4u.com/forums/
Web Consultants Web Site : http://just4u.com/webconsultants
   Give the Gift of Life This Year...
     Just4U Stop Smoking Support forum - helping smokers for
      over three years-tell a friend: http://just4u.com/forums/
          To get 500 Banner Ads for FREE
    go to http://www.linkbuddies.com/start.go?id=111261
---------------------------------------------------------------------

Reply via email to