Dynamically showing or hiding an object

Problem


You can put conditions behind whether to display your buttons, but these conditions only get referred to on page load. Even on page refresh, only things like reports are refreshed, buttons would remain hidden (or not).

Solution

In this example I have a button which I only want displayed if the value of field was met. The value could change after the page was initially loaded.
Hide the button on page load.
Use dynamic actions and Java script to show buttons.


I hide my "Confirm" button like this
$x_Hide('CONFIRM')

I now want to conditionally display it. I suppose I could have all put it in one script. But nevertheless...


var x = $v("P15_STATUS_ID");

if(x=5) {$x_Show('CONFIRM');}


I want my "Confirm" button to conditionally appear after I press the "Refresh" button (assuming that my javascript above didn't show it already).
So I put a dynamic action on the Refresh button, executing Javascript.



I show my "Confirm" button like this
$x_Show('CONFIRM');

Note:
Even if using Javascript, the condition on the button will still be evaluated. This suits me fine.
So in my case I had a PL/SQL condition to determine whether the "Confirm" button should be displayed.

Result.

When the page is opened it first hides the Confirm button, then conditionally shows it using javascript.
Assuming that the button is still hidden, I want the Confirm button to suddenly appear after I push the Refresh button, and this is also achieved with Javascript.


Acknowledgment

http://hardlikesoftware.com/weblog/2015/04/15/apex-and-asynchronous-ajax/
https://community.oracle.com/thread/1014298?tstart=0







Comments