binovpd
asked on
confirm submit then disable button
Hi all,
Simple question. I know how to disable a submit button when clicking a button in a form but I want to disable it AFTER a confirm statement. Seems simple enough. A confirm isa true false response so how would I disable on true?
<script LANGUAGE="JavaScript">
<!--
function OrdSubmit()
{
var sagree=confirm("Click OK if you want to submit this order?");
if (sagree)
document.orderSubmit.Subut ton.disabl e = true;
document.orderSubmit.submi t();
else
return;
}
// -->
</script>
<form name="orderSubmit" method="POST" action="" id="orderSubmit">
<input type="button" ID="Subutton" name="Subutton" value="Submit" onclick="OrdSubmit(this.fo rm)">
</form>
Simple question. I know how to disable a submit button when clicking a button in a form but I want to disable it AFTER a confirm statement. Seems simple enough. A confirm isa true false response so how would I disable on true?
<script LANGUAGE="JavaScript">
<!--
function OrdSubmit()
{
var sagree=confirm("Click OK if you want to submit this order?");
if (sagree)
document.orderSubmit.Subut
document.orderSubmit.submi
else
return;
}
// -->
</script>
<form name="orderSubmit" method="POST" action="" id="orderSubmit">
<input type="button" ID="Subutton" name="Subutton" value="Submit" onclick="OrdSubmit(this.fo
</form>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks basicinstinct.
ASKER
Ont thing however. It needs to post the form after disabling the button. Not just disable the button. Thats what I was having problems with
ASKER
Like so
var sagree=confirm("Click OK if you want to submit this order?");
if(sagree)
{
document.orderSubmit.Subut ton.disabl ed = true;
document.orderSubmit.submi t();
}
return sagree;
var sagree=confirm("Click OK if you want to submit this order?");
if(sagree)
{
document.orderSubmit.Subut
document.orderSubmit.submi
}
return sagree;
function OrdSubmit()
{
var sagree=confirm("Click OK if you want to submit this order?");
document.orderSubmit.Subut
return sagree;
}