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