Forum Moderators: open
onclick="javascript:return confirm('Did you change the Shipping Status? \nClick Cancel to go back')"
onclick="this.disabled=true;"
I need the user to confirm that they changed the shipping status first and then if true then I need the submit button disabled. If they click cancel from the prompt then I need the submit button to remain enabled.
I tried calling the two like this
onClick="javascript:return confirm('Did you change the Shipping Status? \nClick Cancel to go back'); this.disabled=true;"
But when the user clicks OK the submit button is not disabled.
I think I need the two rewritten into a function and then just call the function from the submit button.
Any help please?
but it could be done as a oneliner;
javascript:if(confirm('Confirmation Question')){this.disabled=true}else{this.disabled=false}
I have not tested this but it probably could be shortened more to
javascript:this.disabled=(confirm('Question'))?true:false;
The first code works except if you click cancel the action is still completed (Order is printed).
If the user clicks cancel then the form should not be processed.
Any ideas?
Here is the entire form code
<form action="/" method="get" name="printform" id="printform" target="_blank">
<input type="hidden" name="M_OrderID" value="<?php echo $M_OrderID;?>" />
<input type="Submit" name="Submit" id="Submit" value="Print Order" onclick="javascript:if(confirm('Did you change the Shipping Status? \nClick Cancel to go back')){this.disabled=true}else{this.disabled=false}" onfocus="blur()" /></form>
[edited by: boxfan at 7:12 pm (utc) on Sep. 8, 2006]