That works fine and the button action is cancelled if the user clicks Cancel on the confirm box. But I really want it to be a bit more sophisticated and take parameters to determine whether it displays the dialog box or not.
As a first step, I have a JS function such as:
I then change my button to:
onclick="checkLivePolicies(3)"
It executes the function and shows the confirm box. But it still executes the action of the button, even if I choose CANCEL. Can anyone tell me if there is a way to fix this?
As a first step, I have a JS function such as:
Code:
function checkLivePolicies(policyCount) {
return confirm('This has ' + policyCount + ' live policies which will cancelled. Are you sure?');
}
I then change my button to:
onclick="checkLivePolicies(3)"
It executes the function and shows the confirm box. But it still executes the action of the button, even if I choose CANCEL. Can anyone tell me if there is a way to fix this?