⏱️ No More Clicking! Auto Dismiss Notifications in Oracle APEX

🚩Introduction 

  • In Oracle APEX applications, alert messages like success, error, or warning notifications help users understand what is happening in the system. But sometimes these messages stay on the screen until the user closes them, which can interrupt their work.

  • To improve this, we can use JavaScript to automatically hide the messages after a few seconds. This allows users to read the message and continue working without extra clicks, making the application cleaner and easier to use.

📑 Why This Approach Is Needed

In Oracle APEX applications, alert messages are used to show success, error, or warning updates to users. But if these messages stay on the screen until manually closed, they can slow down the user and make the page look messy.

Using automatic dismissal with JavaScript is helpful when:

  • Users should see messages without needing to close them manually
  • The screen needs to stay clean and less crowded

  • Quick actions like form submissions need smooth feedback

  • Users should not be interrupted while working

  • The application should feel faster and more user-friendly

  • A simple and modern user experience is required

This approach makes the application easier to use, saves time, and improves the overall user experience by handling alert messages in a smooth and automatic way.

👉 Use Case: Auto Dismissal of Alert Notifications Using JavaScript

In Oracle APEX, alert messages show updates like success, error, or warning to users. Instead of making users close these messages manually, we can use JavaScript to automatically hide them after a few seconds. This allows users to continue their work without any extra steps.

In this blog, we will see how to auto-hide alert messages using JavaScript in Oracle APEX. This makes messages easier to read and helps improve the overall user experience.

Step 1: 

We need to hide the error messages across all the pages, so were are going to do this in the Global page to make this work in all the pages. In the App builder, go to the page 0 (Global Page) and create one dynamic action of event type page load.


 Step 2: 

Create a true action of type Execute Javascript Code and copy the below javascript code. We Configured to 3 seconds to dismiss the alert. (i.e) once the message is shown and after 3 seconds the alert messages will be dismissed automatically. 

//Global page (0) -> Page Load Dynamic Action

apex.message.setThemeHooks({
  beforeShow: function(pMsgType, pElement$) {     setTimeout(function() {       $('.t-Alert').fadeOut('slow');     }, 5000); // this you can replace with your time ( in seconds)   } });  $(document).ready(function () { setTimeout(function () { $('.t-Alert--success').fadeOut('slow'); }, 5000); // this you can replace with your time ( in seconds) });

Step 4: 

Now save the page and run the application, to test this concept run any page that has the notifications either error / success messages and now these messages will be auto dismissed.

🔥 Conclusion

Thus in Oracle APEX, alert messages can be automatically hidden using JavaScript. This lets users view important messages without manually closing them each time, saving time and effort. It keeps the application clean and simple while improving usability. Users get quick feedback and can continue their work without interruption.

Comments

Popular posts from this blog

🔍 Extending Smart Search Filter for Multiple Regions

💡 Designing Dynamic QuickPicks in Oracle APEX

📌Track Active Tab switch in Region Display Selector without any plugins