If I set enableModifiedFlag property to true on my Custom Control; I see the following code at the bottom of generated Page source.
Everything works fine when user moves away from changed page; they get the alert message of "Unsaved Data"
<script type="text/javascript">
function view__id1__id2__id95__id98__id105_clientSide_onclick(thisEvent) {
return validateForm();
}
XSP.attachDirtyUnloadListener("This document may contain unsaved changes.");
XSP.addOnLoad(function() {
XSP.attachEvent("view:_id1:saveActionEventHandler", "view:_id1", "ondirtysave", null, true, 2);
XSP.attachEvent("view:_id1:_id2:_id95:_id98:_id105", "view:_id1:_id2:_id95:_id98:link1", "onclick", view__id1__id2__id95__id98__id105_clientSide_onclick, true, 2);
XSP.attachEvent("view:_id1:_id2:_id95:_id98:_id106", "view:_id1:_id2:_id95:_id98:link2", "onclick", null, true, 2);
XSP.attachDirtyListener("view:_id1:_id2:_id95:_id98:businessName11");
XSP.attachDirtyListener("view:_id1:_id2:_id95:_id98:businessName21");
XSP.attachDirtyListener("view:_id1:_id2:_id95:_id98:address11");
XSP.attachDirtyListener("view:_id1:_id2:_id95:_id98:address21");
XSP.attachDirtyListener("view:_id1:_id2:_id95:_id98:city1");
XSP.attachDirtyListener("view:_id1:_id2:_id95:_id98:cbState");
XSP.attachDirtyListener("view:_id1:_id2:_id95:_id98:zipCode1");
XSP.attachDirtyListener("view:_id1:_id2:_id95:_id98:phoneNumber1");
});
</script>
I have an Exit button with SSJS that unlocks the document if its locked and makes a context.redirectToPage. The problem is that this button is not triggering the code behind the enableModifiedFlag logic so users leave the page without being prompted if they want to leave with unsaved data.
Is there any way to trigger code behind enableModifiedFlag from this button using CCSJ or SSJS?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…