Press "Enter" to skip to content

Oracle Apex: Let User Select the Theme of His Choice

You can create an option in your Oracle Apex application to give the user an ability to select the theme of his choice at runtime. Below is a simple example. Follow these steps:

1. Create a Page in Oracle Apex

Create a normal page (not a dialog page) in your application and set the following property:

  • Page Mode: Normal

2. Create a Region

Create a static region and set the following properties:

  • Title: Select Theme
  • Column Span: 5
  • Template: Standard

3. Create a Radio Button

Do the right-click on the region you just created and then select the option Create Page Item and set the following properties:

  • Name: P2_THEMES
  • Type: Radio Group
  • Label: Themes
  • Number of Columns: 1
  • List of Values: SQL Query
  • Display Extra Values: No
  • Display Null Value: No
  • SQL Query: Add the following query in it:
    Decode(nvl(apex_theme.get_user_style(:app_id, :app_user, s.theme_number), 0), s.theme_style_id, || '(Current Theme)', s
    .name) d,
    s.theme_style_id r
    apex_application_theme_styles   s,
    apex_application_themes         t
    s.application_id = t.application_id
    And s.theme_number = t.theme_number
    And s.application_id = :app_id
    And t.ui_type_name = 'DESKTOP'

4. Create a Dynamic Action on Radio Button

Do the right-click on the radio button on P2_THEMES and select the option Create Dynamic Action and set the following properties:

  • When: Change
  • Selection Type: Item(s)
  • Item(s): P2_THEMES

5. Create a True Action

Create a True action on the above dynamic action and set the following properties:

  • Action: Execute PL/SQL Code
  • PL/SQL Code: Add the following code in it:
    apex_theme.set_user_style(p_application_id => :app_id, 
    p_user => :app_user, 
    p_theme_number => 42, 
    p_id => :p2_themes);
  • Items to Submit: P2_THEMES, APP_ID, APP_USER
  • Fire on Initialization: No

6. Create One More True Action

Create one more True action and set the following properties:

  • Action: Execute JavaScript Code
  • Code: location.reload();
  • Fire on Initialization: No

It is done now. Save the changes and run the page to test.

Now when you change the radio button, it will change the theme at that moment.

Oracle Apex: Change theme at runtime.

Related Tutorials:

Have you found the answer to your question? If not, you can discuss it with me in the comments section below or join my Q&A community for developers and ask your question. It is FREE.

Vinish Kapoor


Hi, I am a full stack developer and writing about development. I document everything I learn and help thousands of people. is created, written, and maintained by me; it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub, and get notifications for new posts.

Inline Feedbacks
View all comments