"Vincent M." <cu**@free.fr> writes:
I have a form which allow to submit a file, I'd like to block the
submit buton once it has been clicked, so I tried:
Highly annoying! I sometimes use a web site where they do that. I
submit something for a search, and then later use the back button to
get back and do another search, but it doesn't work. Do I have to
reload the page and lose the entered data.
How about just using a confirm dialog asking "Are you sure you want
to submit this form more than once?"?
function SubmitNow(item){
if(item.value=="Please wait") {
return false ;
i.e.: return confirm("Are you sure ... more than once?");
} else {
item.value="Please wait" ;
item.form.submit ;
This line does nothing. It doesn't call the functions. It doesn't
have to either, since the function returns undefined, so the normal
effect of the click should take effect. I recommend keeping it
this way. I.e., just drop that line.
}
}
With inside the submit buton:
<input class=submit type=submit value=Valid name=submitbtn
onClick="SubmitNow(this);">
You don't return the result of SubmitNow, so the return false is
irrelevant. Change it to
onclick="return SubmitNow(this)"
But it does not work :( We can send several times the same file...
You could even remember the names of the files that have already
been sent and only warn if the same file is sent twice.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'