Entry
How can I prevent user for double clicking on a link and submitting twice?
Dec 30th, 2005 09:28
Srini vasan, Ky Dang, Anet,
I would trap only one occurance of the button and ignore the rest.
(Try working with the codes below. I have not tested it so let me
know
if it does not work for you.)
<script>
trap=0
Function sendOnce()
{ if (trap == 0)
{
document.myForm.submit();
}
trap=trap+1;
}
</script>
<body>
<form action="sendOnce();">
<input type="button" value="Go" name="B1" onclick="sendOnce();">
</form>
</body>
=============
The above example does not work because the second time you click the
link, the page does not refresh with the changes from the server even
though the server has processed the page. On clicking more than once
the control stays on the original page itself...
- Srini