473,566 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Ple ase wait" ;
item.form.submi t ;
}
}

With inside the submit buton:

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

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

Any idea ?

Thanks,
Vincent.

Jul 20 '05 #1
3 5072
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="Ple ase wait" ;
item.form.submi t ;
}
}

With inside the submit buton:

<input class=submit type=submit value=Valid name=submitbtn
onClick="Submit Now(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="submi tbtn.disabled=t rue">
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="Ple ase wait" ;
item.form.submi t ;
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="Submit Now(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/rasterTriangleD OM.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
5448
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 ensuring that someone isn't able to submit thier information twice, or to somehow have the database checked before inserting the information, to see if...
1
5059
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. However, if I try and stop the user submitting a second time (if they click the button for a second time despite the form processing message) by using...
6
11385
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 4.5 and a good deal of the page processing depends on whether or not a control is defined. To prevent users from clicking on a submit button more...
2
6042
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 ************************************************* <html> <head>
3
3149
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 the submit button once it's been clicked, yet still have the form submit. I can do this in ASP 2.0, however, ASP.Net seems to be adversely affected...
5
17687
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 type=password maxlength="8" name="password" value="`pss`"> where usr and pss are sent from the previous form.
3
1129
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" onclick='return checkDetails();' /> formObj = document.forms; //refers to the current form. formObj.submit(); //submits. It...
3
1325
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 fine most of the time, but when it submits with the timer, sometimes it goes in the db many times. When the user clicks submit, it goes in once. When...
5
2317
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. Thanks zlf
0
7673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7893
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7645
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.