PDA

View Full Version : OnCancel????


jmirick
12-13-2001, 02:19 PM
I have a form and if the user goes crazy and clicks the submit button/image a few times while it is processing it causes trouble.

soooooo.... I was thinking about adding a boolean value that marks if the form has been submitted or not and stops and doesnt submit the form if it has. The problem i see is the cancel button... what if someone submits the form and as it is processing presses the stop button of the browser. The page will stop processing... but my boolean will be set so they can never submit the form!!

Any ideas?

thanks

Dr. Web
12-13-2001, 06:40 PM
what I do is onsubmit disable the submit button. If they press submit, then stop on the browser, the form has still been submitted.... so there is no reason to allow them another try. What I might do is if at anytime that they press reset, the form resets AND the submit button becomes enabled again.


<input type=button value=submit name=submit onClick="document.formName.submit.disabled=true; onFocus=this.blur(); formName.submit();">

<input type=reset onClick="document.formName.submit.disabled=''; formName.reset()">

scoutt
12-13-2001, 06:42 PM
not sure if you can do that. once the user pushes the submit button and the page goes blank when trying to load the next page, you can't stop it with code. it is already done with the process.

just tell them to only press once.