Configuring confirmation modal dialog boxes
Ensure that users do not unintentionally lose work by configuring confirmation modal dialog boxes (dirty forms) that web browsers display natively. For example, after a user changes a name in a case and tries to close that case, the system displays a modal dialog box with a message that unsaved changes might be lost.
- Default dirty form
- Native browser dirty form
Dirty forms are displayed when users makes changes in the current rule, and then try to navigate away or close that rule. The default modal dialog box gives the option to discard the changes, save the changes, or cancel the attempted action and remain in the current rule. When users work on a work object, and then try to use a local action (for example, an option on the Actions menu), the dialog box is displayed, but the save option might not work as intended. By configuring the native browser dirty form, you prevent that situation.
- In the header of Dev Studio, search for and open the UserWorkForm HTML Fragment rule.
- On the HTML tab, in the HTML Source
section, in the
script
tag, set thepega.u.d.bUseNativeDirtyConfirm
flag totrue
, as shown in the following code snippet:<script> pega.u.d.bUseNativeDirtyConfirm = true </script>
- Optional: To enable confirmation dialog boxes for frameless portals with work items that
include Post value or Refresh
local actions, perform the following actions:
- Set the
pega.u.d.handleDirtyForFramelessPortals
flag totrue
. - Add a function to execute during refresh, as shown in the following
code snippet:
function confirmationBox() { if(pega.ctx.gsectionReloaded) { pega.ctx.ignoreDirtyState = false; } }
- For the control that triggers the refresh, configure a Run
script action that calls the
confirmationBox
function defined in step 3.b.For more information, see Adding action sets to a control and Adding scripts and style sheets to a harness.
- Set the
- Click Save.
Previous topic Configuring a modal dialog box for a list-based layout Next topic Adding a chart