Translate

Dienstag, 20. Juni 2017

APEX 5.1 - Show Region - start hidden - upon change of value

APEX 5.1.1

Business Case: 
Upon selection of a specific service, the user is prompted to fill in 3 extra fields in a region...

Challenge: 
SHOW the "hidden" region upon change of a value

Solution:
Change template to hide a region by default - create Dynamic Action (DA) to unhide

----

As APEX does not dispose of a region, which is hidden by default, we have to "hide" a region first by changing the Region Template.

Thanks to Matt Mulvaney, who figured that out in his blog (also for buttons and labels).

Step 1: Change Template
In the Template section we have to add  style=”display: none;”  just before the last right-chevron character (>) on the first line.

So I chose a Region Template of template Class "Form Region" and copied it to read:



I added the   style=”display: none;”  to look as follows:



Step 2: Apply region template

We select the region on our page and apply this new template: "Form region start Hidden"

Step 3: Create a Dynamic Action

1. select the region to show (or un-hide...) containing the fields
2. in the left panel right click on the region and select "Create Dynamic Action"
3. select the properties in the right panel.... my case:




As you can see, when values 7 or 101 are entered in the item/field the DA shall fire....

4. Go back to left panel and select the DA - right click and "Create TRUE action"




This having achieved, we have to create the  "Hide" action, to hide the region again, when a different value is selected:

5. In the left panel select DA again and right mouse click on it and select:

"Create Opposite action"

That's it. I think it is a cool and useful feature. Have fun !!!

Dienstag, 6. Juni 2017

APEX 5 - Quickpicks for Date_Picker



APEX 5.1.1 - Universal Theme 4.2

When using the Quickpicks feature for a field - which is quite useful ! - I wonder which value to use to achieve SYSDATE -1 for a date_picker field...?

I did ask @ the apex discussion forum....

and myself solved it as follows:
1) I created a hidden Item "P1_DATE_DEFAULT_0" to hold the default value with source = pl/sql expression : TO_DATE(SYSDATE)


2) I created a hidden Item "P1_DATE_DEFAULT_1" to hold the default value with source = pl/sql expression : TO_DATE(SYSDATE) -1

3) I created a hidden Item "P1_DATE_DEFAULT_2" to hold the default value with source = pl/sql expression : TO_DATE(SYSDATE) -2

4) Quick Picks Label_1: Today - value: &P1_DATE_DEFAULT_0.

5) Quick Picks Label_2: Yesterday - value: &P1_DATE_DEFAULT_1.

6) Quick Picks Label_3: The day before yesterday - value: &P1_DATE_DEFAULT_2.

In my (german) page it looks like:
Quick_picks_dates.PNG
and works well.