By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,472 Members | 1,219 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,472 IT Pros & Developers. It's quick & easy.

Submit only once.

P: n/a
Hello,

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:

function SubmitNow(item){
if(item.value=="Please wait") {
return false ;
} else {
item.value="Please wait" ;
item.form.submit ;
}
}

With inside the submit buton:

<input class=submit type=submit value=Valid name=submitbtn
onClick="SubmitNow(this);">

But it does not work :( We can send several times the same file...

Any idea ?

Thanks,
Vincent.

Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
This might be a nasty idea but what about putting the button in a div and
when it's clicked hide the dive so the button can't be repressed (as it's
then hidden)
Just my initial thought.

Stu

"Vincent M." <cu**@free.fr> wrote in message
news:3f***********************@news.free.fr...
Hello,

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:

function SubmitNow(item){
if(item.value=="Please wait") {
return false ;
} else {
item.value="Please wait" ;
item.form.submit ;
}
}

With inside the submit buton:

<input class=submit type=submit value=Valid name=submitbtn
onClick="SubmitNow(this);">

But it does not work :( We can send several times the same file...

Any idea ?

Thanks,
Vincent.

Jul 20 '05 #2

P: n/a

"Vincent M." <cu**@free.fr> schreef in bericht
news:3f***********************@news.free.fr...

But it does not work :( We can send several times the same file...

Any idea ?


<form onsubmit="submitbtn.disabled=true">
JW

Jul 20 '05 #3

P: n/a
"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.'
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.