Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disable submit button on first click...

Status
Not open for further replies.

nelco

Programmer
Apr 4, 2006
93
US
I am looking for a java script function which will disable the submit button on first click. Aim is not to allow the user to click submit button twice till the next page is shown.
I am having a problem with users when the connection is slow and they click twice -it result in more than one data being created for the same code / date/ discount.
Any help will be appreciated.
 
Thanks CLFlaVA. I tried that and found that this was diabling the button but not submitting the form.
I used following code and works good.
<script type="text/javascript" language="JavaScript"><!--
var submitted = false;
function SubmitTheForm() {
if(submitted == true) { return; }

document.form1.submit();
document.form1.Submit.value = 'Thank You!';
document.form1.Submit.disabled = true;
submitted = true;
}
//--></script>

This works good. Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top