Requirement: I have an Oracle APEX page. On that page I have button on click of which I want to show the Alert Message.
Sample screen is shown below:
Solution: For solution of the above requirement I will be discussing here two approaches. Off course there are many more approaches by which we can show the Alert Message.
Approach 1: Show Alert Message by using Alert Action
Step 1: Create a button with the below properties
- Button Name: P3_SHOW_ALERT_MSG_DA
- Label: Show Alert Message by using Alert Action
Step 2: Create the Dynamic Action and set the below properties:
- Name: Show Alert Message by using Alert Action
- Event: Click
- Selection Type: Button
- Button: P3_SHOW_ALERT_MSG_DA
Step 3: Set the properties of the True outcome as below:
- Action: Alert
- Text: Hello &APP_USER. I am called using Alert Action
Here &APP_USER. will dynamically pick the Login User Name.
Approach 2: Show Alert Message by using JavaScript
Step 1: Create a button with the below properties
- Button Name: P3_SHOW_ALERT_MSG_JAVASCRIPT
- Label: Show Alert Message by using JavaScript
Step 2: Create the Dynamic Action and set the below properties:
- Name: Show Alert Message by using JavaScript
- Event: Click
- Selection Type: Button
- Button: P3_SHOW_ALERT_MSG_JAVASCRIPT
Step 3: Set the properties of the True outcome as below:
- Action: Execute JavaScript Code
- Code:
apex.message.alert("Hello &APP_USER.. I am called using JavaScript");
Here &APP_USER. will dynamically pick the Login User Name.
Save and run the application. Thus, the ran application is shown below:
Let us now click on the “Show Alert Message by using Alert Action” button and with that throws an Alert with the message as “Hello [email protected] I am called using Alert Action“
Let us now click on the “Show Alert Message by using JavaScript” button and with that throws an Alert with the message as “Hello [email protected]. I am called using JavaScript“
Hence, the solution to our requirement.
If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.
Thanks & Regards,
Susanto Paul
2,688 total views, 14 views today