Search This Blog

Tuesday, July 1, 2025

Using CSS for a Spinner in APEX

In Oracle APEX, enhancing user experience is a key part of building modern web applications. A common requirement is to indicate background activity—such as data loading or processing—using a spinner or loading animation. While Oracle APEX provides some built-in ways to show activity indicators, you can fully customize the look and feel of your spinner using custom CSS. Adding a CSS-based spinner is simple and effective, and gives your application a polished, professional touch.

Adding a CSS Spinner in Oracle APEX

To implement a CSS-based spinner in APEX, you need to define the HTML structure of the spinner, apply custom CSS styling, and control its visibility using either APEX dynamic actions or JavaScript.

Step-by-Step Guide:

1. Create the Spinner HTML
You can place the spinner HTML in a Static Region, usually on a Global Page (Page 0), so it is available across the application:

Region Type: Static Content
Static ID: mySpinner

<div id="mySpinner" class="custom-spinner" style="display:none;">
  <div class="loader"></div>
</div>

2. Add Custom CSS for the Spinner
Go to Shared Components > CSS > Inline CSS or use Page > CSS > Inline on Page 0.

.custom-spinner {
  position: fixed;
  z-index: 9999;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #007cc2;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

3. Show/Hide the Spinner Using JavaScript

To show the spinner during long-running operations, you can use JavaScript or Dynamic Actions.

Using JavaScript:

document.getElementById('mySpinner').style.display = 'flex'; // show
document.getElementById('mySpinner').style.display = 'none'; // hide

You can trigger this via dynamic actions on buttons, AJAX calls, or page processes.

Example: Add a Dynamic Action to Show Spinner on Button Click

  1. Create a button (e.g., "Submit")

  2. Add a Dynamic Action:

    • Event: Click

    • Selection Type: Button

    • Action: Execute JavaScript Code

    • Code:

document.getElementById('mySpinner').style.display = 'flex';
  1. Add another Dynamic Action (if needed) to hide the spinner after a process completes.

4. Optional: Automatically Hide on Page Load

To prevent the spinner from staying visible if the page reloads mid-process, hide it by default using this on Page Load:

document.getElementById('mySpinner').style.display = 'none';

Extensive Use Case Example

You are submitting a form that takes several seconds due to server processing. When the user clicks "Save", show the spinner immediately:

  • Button action: Submit Page

  • Add Dynamic Action before submit:

    • Event: Click

    • True Action: Execute JavaScript Code

    • Code:

document.getElementById('mySpinner').style.display = 'flex';

Spinner appears, form is submitted, and when the page reloads, it hides again thanks to Page Load script.

Best Practices

  • Use z-index and semi-transparent overlays to ensure the spinner appears above all content.

  • Keep spinner minimal for performance.

  • Always provide feedback to users during long operations—spinners reduce perceived wait time.

  • Consider using APEX’s apex.server.process method for AJAX calls and tie spinner visibility to the success callback.

  • Place spinner HTML in Page 0 for global accessibility, but control visibility per page context.

Using CSS to create a spinner in Oracle APEX is a simple and effective way to visually indicate that a process or action is in progress. Spinners enhance user experience by providing feedback during operations like data loading, page submission, or AJAX calls. With a few lines of CSS and optional HTML, you can create elegant and responsive spinners that blend seamlessly into your APEX application's theme. Whether you're customizing the universal theme or building your own template, adding a CSS spinner gives users a clear signal to wait while the system completes a task.

In Oracle APEX, using a CSS spinner is a clean and effective way to indicate that a process—such as a page submission, AJAX call, or dynamic action—is running in the background. You can use pure CSS to create an animated spinner, then show or hide it using APEX dynamic actions or JavaScript.

To begin, you can define the spinner's style by adding CSS to your application's Inline CSS section or a dedicated CSS file. Here's an example of a simple spinner using keyframe animation:

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  display: none;
  margin: auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

Next, add the HTML markup where the spinner should appear. This could be inside a region or static content block:

<div id="mySpinner" class="spinner"></div>

To control the spinner's visibility, use Dynamic Actions or JavaScript. For example, to show the spinner before an AJAX call and hide it after completion:

Dynamic Action Example:

  • Event: Button Click

  • True Action 1: Execute JavaScript Code

$('#mySpinner').show();
  • True Action 2: Execute PL/SQL or AJAX Callback

  • True Action 3 (After PL/SQL/AJAX): Execute JavaScript Code

$('#mySpinner').hide();

Alternatively, you can define a region as a spinner and use APEX’s built-in classes like u-Processing and u-hidden to manage visibility. But using custom CSS gives you full control over appearance and animation.

Adding a CSS spinner improves user feedback and helps prevent multiple submissions or confusion during long-running processes. This technique is simple but highly effective in creating a professional user interface in Oracle APEX.

Using CSS for a Spinner in APEX

CSS (Cascading Style Sheets) allows you to control the look and feel of your Oracle APEX applications by customizing colors, fonts, layouts, and responsiveness. Oracle APEX provides several ways to apply CSS, either globally or on specific elements.

Ways to Apply CSS in Oracle APEX

1. Inline CSS (Element-Level Styling)

Inline CSS is applied directly to an HTML element using the style attribute.

Example:

To change the color of a button:

<button style="background-color: red; color: white;">Click Me</button>

Use Case: Quick styling for a specific element without affecting others.

2. Page-Level CSS (Inside Page Attributes)

You can apply CSS to a single page by adding styles inside the Inline CSS section of a page.

Steps:

  1. Go to Page Designer

  2. Under Page Attributes, find the CSS section

  3. Add your CSS in Inline CSS

Example:

To change the font size of all headings on a page:

h1, h2, h3 {

    font-size: 20px;

    color: blue;

}

Use Case: Customizing the style of elements on a single page.

3. Theme-Level CSS (Global Styling for the Whole Application)

To apply styles across your entire APEX application, you can add CSS inside the Theme Roller or in Shared Components > CSS Files.

Option 1: Using Theme Roller

  1. Open Shared Components

  2. Go to Theme Roller

  3. Customize colors, fonts, and styles

  4. Click Save as Style to apply the changes

Option 2: Uploading a CSS File

  1. Navigate to Shared Components > Static Application Files

  2. Click Upload File and upload your .css file

  3. Reference the CSS file in your Page Attributes inside the CSS File URLs section: 

#APP_IMAGES#custom-styles.css

  1. Alternatively, reference the file in Page Header > HTML

<link rel="stylesheet" type="text/css" href="#APP_IMAGES#custom-styles.css">

Use Case: Making global design changes to the entire application.


4. Applying CSS to Specific APEX Elements

You can target APEX elements using CSS classes and IDs.

Common APEX CSS Classes:

  • t-Button → Styles APEX buttons

  • t-Form-input → Styles text fields and inputs

  • t-Region → Styles report regions

  • apex-item-text → Styles input fields

Example: Styling buttons with a custom color

.t-Button {

    background-color: #0073e6;

    color: white;

    border-radius: 5px;

}

5. Using Dynamic CSS with JavaScript

You can dynamically apply CSS styles using JavaScript.

Example: Change the background color of a button on click

document.getElementById("myButton").style.backgroundColor = "green";

Use Case: Applying real-time CSS changes based on user actions.

Using CSS in Oracle APEX enhances the visual appeal and usability of your applications. You can apply CSS at the element level, page level, or application level using Theme Roller or custom stylesheets. Additionally, JavaScript can be used to apply CSS dynamically.

Adding a Spinner via CSS to an Oracle APEX Page

A spinner (or loading indicator) helps inform users that a process is running in the background. You can add a spinner to your Oracle APEX application using CSS and JavaScript.

Method: Using CSS Only

You can create a simple spinner using pure CSS and display it when needed.

Steps to Add a CSS Spinner

  1. Add CSS for the Spinner

    • Navigate to Page Designer

    • Select your page

    • Under Page Attributes, go to Inline CSS

    • Add the following CSS:

/* Spinner Container */

.spinner-overlay {

    display: none; /* Hidden by default */

    position: fixed;

    top: 0;

    left: 0;

    width: 100%;

    height: 100%;

    background: rgba(0, 0, 0, 0.5);

    z-index: 9999;

}


/* The Spinner Animation */

.spinner {

    position: absolute;

    top: 50%;

    left: 50%;

    transform: translate(-50%, -50%);

    width: 50px;

    height: 50px;

    border: 6px solid #f3f3f3;

    border-top: 6px solid #3498db;

    border-radius: 50%;

    animation: spin 1s linear infinite;

}


/* Spinner Animation */

@keyframes spin {

    0% { transform: translate(-50%, -50%) rotate(0deg); }

    100% { transform: translate(-50%, -50%) rotate(360deg); }

}

  1. Add the Spinner to the Page

    • Navigate to Page Designer

    • Go to Regions

    • Add a new Static Content region

    • Set Static ID to spinnerContainer

    • Add the following HTML inside the Region Source:

<div class="spinner-overlay" id="spinnerContainer">

    <div class="spinner"></div>

</div>

Spinners created with CSS are lightweight, flexible, and easy to control with dynamic actions or JavaScript. By integrating them into your APEX pages, you improve communication with your users and make the application feel more responsive and polished. As with all UI enhancements, testing and consistency across devices are key to delivering a smooth experience.

Oracle APEX Documentation

Refer to the official Oracle APEX documentation for JavaScript integration and page layout:
https://docs.oracle.com/en/database/oracle/apex
Search terms: JavaScript Integration, Dynamic Actions, CSS Customization

Conclusion

Adding a CSS-based spinner in Oracle APEX is a simple way to improve user experience and give your application a modern, responsive feel. By combining custom HTML, CSS, and Dynamic Actions or JavaScript, you can create spinners that activate during long-running processes or AJAX calls. When implemented thoughtfully, this pattern reduces confusion and reassures users that their action is in progress, leading to a smoother interaction with your APEX application.





Create a Working Copy of an Application

 Creating a working copy of an Oracle APEX application is a best practice that allows developers to safely enhance or troubleshoot applications without affecting the live production version. A working copy acts as a separate, editable version of the application where you can freely experiment with new features, UI changes, PL/SQL processes, or integrations. This method is especially valuable in team environments or when preparing for a major release, as it helps ensure that any changes can be tested and reviewed in isolation before being published to end users.

Using working copies in Oracle APEX is a fundamental strategy for managing development and ensuring application stability. A working copy is a separate instance of your APEX application that allows you to develop, test, and make changes without impacting the live production environment. This method helps safeguard the production system by isolating new features, bug fixes, or enhancements until they are fully validated.

To use working copies effectively, start by exporting your current application from the production workspace. This exported application file (.sql) acts as the baseline for your working copy. Next, import this file into a development workspace or a dedicated environment. Here, you can freely modify the application, create new pages, update processes, or alter logic without risking data loss or user disruption. Oracle APEX’s built-in export/import utilities make this process straightforward.

While working on the copy, it’s important to test all changes rigorously. Utilize APEX’s debugging and session state features to verify that your modifications behave as expected. Once the development and testing are complete, export the updated working copy and import it back into the production environment, replacing the existing application or deploying as a new version.

For teams, working copies also support parallel development workflows. Multiple developers can create individual working copies, work independently, and later consolidate changes through coordinated exports and imports. Integrating working copies with version control systems can further enhance change tracking and collaboration.

Overall, working copies provide a safe, efficient, and flexible approach to Oracle APEX application development. They protect live environments, improve testing quality, and enable better team coordination. By incorporating working copies into your development cycle, you ensure smoother deployments and higher application reliability.

  1. Go to App Builder and find the application you want to duplicate.

  2. Click on Utilities > Application Copy.

  3. Choose Copy Application and enter a new name (e.g., "MyApp_Test").

  4. Select the components you want to include: 

    • Pages

    • Application Definition (Pages, Shared Components) 

    • Authentication & Authorization

    • Shared Components

    • Data Model

  5. Click Create Application.

This will create a separate copy of the application that you can modify without affecting the original.

Using a working copy streamlines development, improves code quality, and minimizes the risk of breaking a live application. Once your updates are complete and thoroughly tested, you can either apply the changes manually to the production app or replace the existing version with the updated copy. Incorporating working copies into your workflow leads to safer development practices, promotes collaboration, and helps maintain the stability and reliability of your Oracle APEX applications.

Using Working Copies

 Using working copies is a crucial practice in Oracle APEX development that helps ensure safe and efficient management of application changes. A working copy is essentially a duplicate of your application where you can freely make updates, test new features, and fix issues without affecting the live production environment. This approach not only minimizes the risk of disrupting users but also supports collaborative development by allowing multiple developers to work independently before merging changes back into the main application.

Using working copies in Oracle APEX is a fundamental strategy for managing development and ensuring application stability. A working copy is a separate instance of your APEX application that allows you to develop, test, and make changes without impacting the live production environment. This method helps safeguard the production system by isolating new features, bug fixes, or enhancements until they are fully validated.

To use working copies effectively, start by exporting your current application from the production workspace. This exported application file (.sql) acts as the baseline for your working copy. Next, import this file into a development workspace or a dedicated environment. Here, you can freely modify the application, create new pages, update processes, or alter logic without risking data loss or user disruption. Oracle APEX’s built-in export/import utilities make this process straightforward.

While working on the copy, it’s important to test all changes rigorously. Utilize APEX’s debugging and session state features to verify that your modifications behave as expected. Once the development and testing are complete, export the updated working copy and import it back into the production environment, replacing the existing application or deploying as a new version.

For teams, working copies also support parallel development workflows. Multiple developers can create individual working copies, work independently, and later consolidate changes through coordinated exports and imports. Integrating working copies with version control systems can further enhance change tracking and collaboration.

Overall, working copies provide a safe, efficient, and flexible approach to Oracle APEX application development. They protect live environments, improve testing quality, and enable better team coordination. By incorporating working copies into your development cycle, you ensure smoother deployments and higher application reliability.

In Oracle APEX, working copies allow developers to safely test and experiment with changes before applying them to the live application. Using working copies properly can help prevent issues in production, facilitate collaboration, and improve overall development workflows.

Understand When to Use a Working Copy

 Use a Working Copy When:

  • Making significant UI/logic changes.

  • Refactoring page structures, processes, or PL/SQL code.

  • Testing new features before deployment.

  • Preparing an application for an APEX upgrade.

  • Collaborating with a team while keeping a stable version.

  • When performing upgrades or migrations.

  • When making major changes to an application.

Do NOT Use a Working Copy When:

  • Performing minor text or style changes (use Live Edit or Developer Toolbar instead).

  • Debugging small issues in development mode.

  • Managing multiple environments (use version control or multiple APEX instances instead).

In conclusion, leveraging working copies in Oracle APEX provides a controlled and secure way to develop and maintain applications. By isolating development efforts from the production system, you reduce errors and downtime while enabling thorough testing. Working copies, especially when combined with version control practices, help maintain application integrity and streamline the deployment of updates, making them an essential part of any professional APEX development workflow.

How Do I Use Working Copies for Safe Development

 When developing Oracle APEX applications, using working copies is a vital practice to ensure safe and controlled changes. A working copy is essentially a personal or isolated version of an application where developers can experiment, make updates, and test features without affecting the live production environment. This approach helps prevent unintended disruptions, reduces risk, and allows for thorough testing before changes are merged back into the main application.

Using working copies in Oracle APEX is an important strategy for safe and efficient application development. A working copy is a separate, editable version of an APEX application that allows developers to make changes without impacting the live production version. This helps prevent accidental disruptions and supports collaborative development.

To use working copies effectively, start by exporting your production application from Oracle APEX as a file. This exported file represents a snapshot of your app at that point. Next, import this file into your development workspace or environment where you can safely edit and test your changes. This separate copy becomes your working copy.

When you make updates or add new features, test thoroughly within the working copy environment to verify functionality and ensure no new issues arise. Once you are confident with your changes, export the working copy application and import it back into the production workspace to replace the live app or apply incremental updates.

For teams, version control systems such as Git can be integrated with APEX exports to track changes, manage multiple working copies, and coordinate collaboration. This approach provides history tracking and rollback capabilities, further enhancing safety.

Overall, using working copies allows you to isolate development efforts, avoid risks to production, and maintain a controlled development process within Oracle APEX.

Best Practice: Clone Applications Before Major Updates

Instead of modifying the production app directly:

  1. Go to Utilities > Application Copy.

  2. Create a working copy.

  3. Test changes in the copy before merging them into the main app.

Key Backup Best Practices

  • Export Application & Workspace Regularly

  • Backup the Database (Data Pump & RMAN)

  • Store Backups in Multiple Secure Locations

  • Use Flashback & Undo for Quick Recovery

  • Test Restores Periodically

  • Leverage Version Control (Git, SVN)

  • Use Working Copies for Development Safety

By using working copies effectively, development teams can maintain a smooth workflow, collaborate more efficiently, and safeguard the stability of the production system. Working copies enable developers to review changes, perform quality assurance, and manage versions carefully, ensuring that only well-tested updates are deployed live. Adopting this practice is essential for maintaining high standards in Oracle APEX application development and minimizing downtime or errors in the live environment.

How Do I Track Application Changes Using Version Control

 Tracking application changes using version control is essential for any Oracle APEX developer aiming to maintain organized, efficient, and collaborative development processes. Version control systems allow you to record changes made to your application over time, making it easier to manage updates, revert to previous versions when necessary, and collaborate with team members without conflict. In Oracle APEX, integrating version control helps ensure that all modifications are documented and recoverable, enhancing the overall stability and quality of your applications.

Tracking application changes using version control in Oracle APEX is a crucial practice for maintaining application integrity, facilitating collaboration, and managing development efficiently. Although Oracle APEX does not have built-in version control integration like traditional software development environments, you can implement version control by exporting your applications and managing those exports in external version control systems such as Git, Subversion, or others.

To track application changes, start by regularly exporting your APEX application as a SQL export file. This file contains all the metadata, pages, components, and logic of your application. Exporting can be done manually from the APEX builder interface or automated using Oracle APEX APIs or command-line tools like APEXExport.

Once you have the exported SQL file, commit it to your version control repository. Each commit should represent a logical change or update, accompanied by descriptive commit messages explaining the changes made. This process creates a history of changes that can be reviewed, audited, or reverted if necessary.

When working in teams, each developer can export their changes and commit them, allowing the team to merge and resolve conflicts using the version control system's features. It is essential to establish conventions on when and how exports are made to avoid overlapping changes.

Additionally, consider using branches in your version control system to manage development, testing, and production versions separately. This approach helps isolate changes and supports safer deployment workflows.

Finally, regularly synchronize your version control repository with your APEX workspace by importing the latest versions of the application when needed. Oracle APEX allows importing applications via SQL scripts or through the development interface.

By combining Oracle APEX’s export/import capabilities with a robust version control system, you can effectively track application changes, improve team collaboration, and maintain a reliable history of your development progress.

Best Practice: Use Git or SVN for Change Management

Instead of relying only on APEX exports, store application .sql files in Git:

  1. Export APEX application: 

SELECT APEX_EXPORT.GET_APPLICATION(100) FROM DUAL;

  1. Push to a Git repository: 

git add app_100_backup_20240310.sql

git commit -m "Backup of App 100 on March 10, 2024"

git push origin main

In conclusion, implementing version control for your Oracle APEX applications is a best practice that safeguards your development efforts and streamlines collaboration. By tracking changes methodically, you can maintain a clear history of your application’s evolution, reduce errors caused by conflicting edits, and simplify the process of deploying updates. Whether using built-in APEX export tools or integrating with external version control systems like Git, adopting version control ultimately leads to more reliable and maintainable applications.

HOW DO I SET A HOME PAGE

 Setting a home page in Oracle APEX is an essential step in defining the default landing page for your application. The home page serves as ...