The code below was provided by Metastorm (back in v6 and early v7) which we use on most of our action forms. Its purpose is to replace the standard (non prompt) cancel text with a confirmation box (which happens to include the action name).
However, I cannot seem to identify the v9 (9.2.1 in particular) equivalent functionality for the rewrite.
I'm not sure of the purpose of isFolderPage(), but it controls when the standard cancel action is overridden.
CancelMessage() itself display the confirmation prompt, including the name of the current action (
document.forms("eConfirmCancelForm").Action.value). Ideally, we'd want the action caption now.
function isFolderPage()
{
return (document.forms("eConfirmCancelForm").Action.value=="");
}
function CancelMessage()
{
//as long as the form is not unloading, confirm cancel with the user
if (parent.window.event.type != "beforeunload")
{
if (window.confirm("Are you sure you want to cancel the action: "
+ document.forms("eConfirmCancelForm").Action.value +"?"))
{
parent.CancelClick = oldCancel;
parent.CancelClick();
}
}
else
{
alert("You have closed the form without using the red Cancel button below. Any screen changes have been lost.")
parent.CancelClick = oldCancel;
parent.CancelClick();
}
}
function ConfirmFix()
{
parent.CancelClick = oldCancel;
parent.ConfirmClick = oldConfirm;
parent.ConfirmClick();
}
function replaceCancel()
{
if (!isFolderPage())
{
oldCancel = parent.CancelClick;
oldConfirm = parent.ConfirmClick;
parent.CancelClick = CancelMessage;
parent.ConfirmClick = ConfirmFix;
}
else
{
for (var i=0; i < parent.document.all.length; i++){
if (parent.document.all[i].innerHTML == 'Submit to NMS')
parent.document.all[i].style.visibility = "hidden";
}
}
}