Continuing our series of dynamic action posts, we'll look at how to use the Notifications (Alert&Confirm) in Oracle Application Express (APEX).
As a practical example, we'll generate alerts when some mouse events are performed on a button.
We have two types of notification actions in Oracle APEX: Alert and Confirm.
Alert: Displays an alert message, with a single Ok button. Use to display information that must be responded to, by pressing the button, but continues executing the event.
Confirm: Displays a confirmation dialog, with Cancel and Ok buttons. If the user chooses Cancel then the proceeding actions are not executed and the current event is canceled.
Create Alert and Confirm
1. To create a Dynamic Notification Action generating an alert, go to the Dynamic Actions tab and under Events, right-click and select Create Dynamic Action.
2. We define an identification name for our dynamic action, and in the "When" region, we select the Mouse Button Press event in Browser Events. In the Selection Type option select Button and soon after, the button that will give rise to the event.
3. Once the event has been defined, we need to choose the true action that will be performed. We create a true action and in Identification we select the Alert or Confirm action in Notification and in Settings we insert a text to be displayed in the alert.
4. Once we've done that, we save the changes we made and our dynamic action is in place.
As we have seen, it is quite simple to create notifications using the dynamic actions in Oracle APEX. We could also define a variety of mouse events on the button like Mouse Enter, Mouse Leave or Mouse Move, for example.
To see our Dynamic Action (Alert&Confirm) in action, go to the demo application below.
Link: Learning APEX App
User (default): demo