Skip to main content

Usage

Default Action

In the default action, the plug-in uses the confirm() javascript function to display the warning.

Custom Action

The custom action is for displaying alerts in a different style. For example, you can display an alert with a plug-in like United Codes SweetAlert2. When selecting Custom action, a new dynamic action, "Custom (ucwarnunsaved event)," must be added to trigger the "Alert on page changes" (ucwarnunsaved) plug-in event.

Custom (event ucwarnunsaved)

Example code that can be used in the custom event "Warn about page changes" :

if (this.data.history) {
var ok = apex.page.confirm(this.data.message);

if (ok == true) {
history.back();
} else {
// Stay on the current page.
history.pushState("dialogHist", null, window.location.pathname + window.location.search);
}
}
else {
var ok = apex.page.confirm(this.data.message);
if ( !ok ) {
this.data.event.preventDefault();
this.data.event.stopPropagation();
}
}

Tested On

Oracle APEX Versions:

  • Application Express 18.1
  • Application Express 18.2
  • Application Express 19.1
  • Application Express 19.2
  • Application Express 20.1
  • Application Express 20.2
  • Application Express 21.1
  • Application Express 21.2
  • Application Express 22.1
  • Application Express 22.2
  • Application Express 23.1