Pages

Tuesday, 22 October 2013

APEX 101 - Set region title on page load

I saw a forum post recently asking how to dynamically change the region title.

This is a little ambiguous - is this dynamic to the value set in APEX meta-data, or dynamic as a result of user events on the page?

Here is the instructions for the former:

1) Create new hidden item called P6_REGION_TITLE. I placed it on the same region as my form items.

2) Create a computation for this item Before Header, with perhaps a SQL expression like
Region title computation
This extends the concept of Pn_MODE demonstrated in my sample application, discussed in this tutorial. You could also interrogate Pn_ID to determine if reading an existing record or creating a new one.
CASE :P6_MODE 
WHEN 'R' THEN 'View employee'
WHEN 'E' THEN 'Edit employee'
END

3) Modify the region title to
&P6_REGION_TITLE.

When the page renders, the region title will be set relevant to the edit mode.

Here is a post how to modify the title after the page has rendered - often useful for modal dialogs or master/detail pages.

Scott

1 comment: