Question
TapRoot Solutions LLC
US
Last activity: 16 May 2017 18:49 EDT
Confirm message on Close Modal dialogue
Hi,
we have a requirement to show confirm message when user closes the modal dialogue. anyone has any idea to achieve this ? In a regular szcreen, Pega provides a OOTB feature to show this confirm but to achieve this in a modal dialogue is a challenge.
Any response is appreciated.
To elaborate
Hide the action section button from "Action" tab of your local action associated with the modal window.
copy the buttons from the pzModalTemplate to your section that is displayed in the modal window
Remove the Submit button and replace it with your own button, Add a action to call "RunScript"
Script can be included in the userWorkForm with the following (OR) something similar. I am not 100% sure about the doModalAction(pega.u.d.submitModalDlgParam,event) call. Just copied it off of the pzModalButton controls. It seems to work ok for my use case. As always TEST THOROUGHLY before use!
<script>
function showWarning() {
alert("in show warning");
var ans = confirm("Do you want to close ?");
if (ans)
doModalAction(pega.u.d.submitModalDlgParam,event);
else
return;
}
</script>