Anshul Ayushya
Anshul Ayushya

Reputation: 129

How to hide a region and unhide it on a button click in Oracle apex?

I want to hide a region and unhide it on a button click in Oracle apex, but its showing an error on false action that in when condition nothing is defined. Can anyone please help me regarding this. Regards, Anshul Ayushya

Upvotes: 1

Views: 6419

Answers (3)

Daniel Frech
Daniel Frech

Reputation: 335

If you only want to have one button for showing/hiding the region, you might also use jQuerys .toggle() function. For that, add a static ID to your button and create a dynamic action with a JavaScript action that runs the following:

$("#<<STATIC_ID_OF_BUTTON>>").toggle();

This will hide/show your region on every click of the button. To load the region hidden, just add the following CSS for the region:

#<<REGION_STATIC_ID>>{
    display:none;
}

With .toggle() you can also add options, such as defining a function to execute once the toggle actions has completed or the duration of the toggle animation such as:

$("#<<STATIC_ID_OF_BUTTON>>").toggle({
    duration: 400,
    complete: () => {"do someting here"}
}); 

See the jQuery documentation of the .toggle() function for a full list of options.

Upvotes: -1

nrms
nrms

Reputation: 81

You could have a look at collapsible region. Create a region, Appearance needs to be set to Collapsible (you can configure the options right below in Template Options). Some types of regions do not offer Collapsible (e.g. Interactive Report), but then you could just create a static content region, make it collapsible and create a subregion of the desired type. And you are done.

Upvotes: 2

Littlefoot
Littlefoot

Reputation: 143103

A simple way to do that is to create two buttons: one to hide a region, and another to show it.

  • create them using default settings; nothing special
  • create dynamic actions for both of them
    • "Hide" button should have the "hide" action, it affects a "region" whose name is selected from the list of available regions
    • "Show" button should have the "show" action, it affects a "region" whose name is the same as for the "Hide" button

Run the page and enjoy in hiding/showing the region.

Upvotes: 2

Related Questions