CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Double submission when double clicking

Print topic Send  topic

Author Message
Gijs
Posted: 04/09/2003, 2:57 AM

Hi,

Maybe someone has a solution for my problem:

When someone clicks submit from a certain form 2 times then the data is submitted 2 times.

How to prevent this?

Thanx,

Gijs
PvD
Posted: 04/09/2003, 5:31 AM

Hi Gijs,

the solution I use is to disable the buttons as soon as they have been clicked.
There are several ways of doing it, but the easiest is to change the submit button type from type="submit" to type="button" and then add an onClick event.

In the header of the doc you put the following:
<script language="JavaScript">
function disableButtons() {
document.formname.buttonname.disabled=true;
document.formname.submit();
}
</script>

In the body you put:
<form name="formname" action=(action)>
<input (whatever input you specify)>
<input type="button" value="Submit" name="buttonname" onClick="disableButtons()">
</form>

Adding an onSubmit="return false" to your <form> tag will also prevent the enter button from sending the form.

Hope this helps,

Peter
onClick="disableButtons()"
Gijs
Posted: 04/16/2003, 4:44 AM

Thanx Peter

It works fine now!

Gijs

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.