Replace Standard Cancel with a Confirm Cancel
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"; } } }
Comments
-
I could still use some feedback on how to perform the "confirm" action above.
However, similar to my "link" question ... I'm also have issues calling client scripts scoped to "All" instead of scoping to a specific form. If this is indeed the case, it sure limits its usefulness.
0 -
v9+ has built in client side events on cancel and submit you can handle. If you return false in the event, it will be killed. It looks like you have more stuff going on elseware at a global scope with your posted js, so rather than using that, would something like this work in your scenario?
//When form cancelled event if (confirm('Are you sure you want to cancel the action:' + getField('txtHiddenActionCaptionField') + '?')) { return true; } else { return false; }
0 -
Much cleaner than the old process. It seems to work well with a quick test anyway.
Thanks! :smileyhappy:
Now to hope the client side "All" scope gets resolved once I clean out what the conversion tool created, but that is a topic for another time once I get through the forms clean/replacement/rewrite from what the conversion tool did.
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 152 General Questions
- 148 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 190 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 10 XM Fax
- Follow Categories