Discussion Locked

Javascript Confirm Box question

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I've got a form with a radio button that prompts a confirm box if the value is YES. What I'm trying to do is to have it submit the form if the user clicks the OK button or open a Help popup window if they click CANCEL. Any suggestions?

2 replies

by ed woychowsky

I do something similar, the client has the option of changing their mind when deleting an order. What I do is set the cursor to an hourglass and submit the form via JavaScript when ‘OK’ is clicked. When cancel is clicked I just make sure that the cursor is set back to ‘auto’. Note, that ‘thisForm’ is the form name and that the submit action can be modified by changing ‘document.thisForm.action’ to the next page. Hope this helps.

if(confirm('Are you sure that you want to cancel this order?')) {
document.body.style.cursor = 'wait';

document.thisForm.submit();
} else
document.body.style.cursor = 'auto';

by shabir_hakim1

write code like

//declear variable
var con;
con=confirm("What You Want To Do")
if(con==0)
{

alert("first option pressed")
}
else
{
alert("second option pressed")
}

This discussion is closed to new replies.