How to Hide a Region in Oracle Apex?

How to Hide a Region in Oracle Apex?

In this tutorial, you will learn how to hide a region in Oracle Apex.

What is a Region Oracle Apex?

In Oracle Application Express (APEX), a region is a fundamental building block used to organize and display content within a web page. It serves as a container for various types of user interface components, such as forms, reports, charts, and static text, allowing developers to structure and present data and functionality in a coherent and user-friendly manner. Regions play a pivotal role in the design and layout of APEX applications, enabling developers to create dynamic and interactive web pages without the need for extensive coding.

How to Hide a Region in Oracle Apex?

Here we will see two examples, in the first example, you will learn how to hide a region in Oracle Apex on a button click. And in the second example, you will learn how to hide a region when an item value changes (in the background or when the user types in it).

Example -1: Hide a Region in Oracle Apex on a Button click

Follow these steps:

  1. In your Oracle APEX application, navigate to the page where you want to add the button and region.
  2. In the Page Designer, create a button and a region that you want to hide on the button click.
  3. Then do the right click on the button and select the option Create Dynamic Action.
  4. Create a True action Hide and select the Selection Type as "Region" and select the region you want to hide as shown in the below image:
Oracle Apex hide region on button click example.
  1. Keep the Fire on initialization setting off, else it will hide the region on page load.
  2. Now save the changes and test the page.

Example-2: Hide a Region When Item Value Changes in Oracle Apex

  1. In the Page Designer, do the right click on the item and select the option Create Dynamic Action from the drop-down menu.
  2. Select the Event Change (it is a default value).
  3. Then select the Client Side Condition, item is not null and select your item from the Item drop-down as shown in the below image:
On-change dynamic action setting.
  1. Now Create a True action as Hide and specify the settings as shown below:
Dynamic True action hide setting in Oracle Apex
  1. Then do the right click on the Hide action and select Create Opposite Action, this will create a False action Show. Now if the item is not null the region will hide and when the item is null the region will be displayed. You can set these properties according to your requirements.
  2. Now save the changes and test the page.

Conclusion

You've learned how to hide a region in Oracle APEX using two ways:

  1. How to hide a region when someone clicks a button.
  2. How to hide or show region when someone changes the value of an item.

These skills help you make your web apps more interactive and user-friendly. You can now control what users see and when they see it, which is pretty handy!

Related: