473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Submit only once.

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
3 5059
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

"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: entoone | last post by:
I have an html form, that has fields and when the submit button is pressed, the information is transferred to a php file. Which then inserts the data into my sql database. How can I go about...
1
by: David Bradbury | last post by:
Hi On my form, as soon as the user clicks my submit button a message pops up saying "Form processing" as the form submits. This is fine as long as the user only clicks the submit button once....
6
by: JSjones | last post by:
Hi all, I'm new to these boards and my javascript experience is fairly limited and basic so please bear with me. Anyway, on to the question and some background. I'm developing using ColdFusion...
2
by: tony wong | last post by:
i wish the html to submit the form once it is loaded. what should be the code here (alert("how 's the code here"))? Grateful if you could help me. Thanks a lot. Tony...
3
by: Jeff | last post by:
I have a payment form with a submit button. A large percentage of users double-click the submit button thus submitting their payment information twice. I would like to use javascript to disable...
5
by: Navillus | last post by:
Hey gang, I have a login form that is empty by default, but can be filled with values from a previous form: <input type=text maxlength="40" size="40" name="user" value="`usr`"> <input...
3
by: dandrew22 via DotNetMonster.com | last post by:
Hi all I'm completely new to ASP.Net and need some help please. I'm doing some client side validation using Javascript. The relevant code is below: <input type="button" value="submit"...
3
by: fluff | last post by:
Hello I am using frontpage 2002 and asp. I have a form that submits after the user clicks submit and if the user forgets to click submit, the page submits after a couple of minutes. It works...
5
by: zlf | last post by:
How to disable button once it is clicked on the page? The codes in click event of submit button is time-costing(about 4-5 secs), in this period, user maybe do a re-submit, that is not expected. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.