16.5.2.2.1 Defaulting URL Template Page Items

Use APEX_PAGE.GET_URL to compute the template URL containing page item placeholders you replace with client values when opening the dialog.

This variant of the Open Position Referrals page contains two hidden page items to store URL templates:
  • P11_DRAWER_MODAL_URL_TEMPLATE – to open modal drawer page 23
  • P11_DIALOG_MODAL_URL_TEMPLATE – to open modal dialog page 27
The expression to compute the value of the drawer modal URL is:
apex_page.get_url(
    p_page      => 23,
    p_items     => 'P23_JOB_ID',
    p_values    => '$P11_SELECTED_JOB_ID$',
    p_plain_url => true)

Notice, the value of the P23_JOB_ID parameter is set to the name of the P11_SELECTED_JOB_ID page item, surrounded by dollar signs. The JavaScript helper code looks for names of this pattern and replaces them in the template with the current value of the named page item.

The expression for the dialog modal URL is the same, just using a different page number:
apex_page.get_url(
    p_page      => 27,
    p_items     => 'P27_JOB_ID',
    p_values    => '$P11_SELECTED_JOB_ID$',
    p_plain_url => true)

There are three ways to default the value of page item:

Table 16-1 Three Approaches to Defaulting a Page Item Value

Approach Use When You Need
Default setting An initial value if the page item is otherwise null.
Source setting A computed value to always be used, when not associated to a form region.
Computation or page process assignment in the Pre-Rendering section An optionally-conditional assignment visible at the "top" of the page rendering tree.

The Open Position Referrals page shows two of these three approaches. As shown below, the P11_DRAWER_MODAL_URL_TEMPLATE's source value uses a PL/SQL Expression set to always be used. The figure shows the P11_DRAWER_MODAL_URL_TEMPLATE hidden page item selected in the component tree, and highlights the APEX_PAGE.GET_URL expression described above that generates its URL template value.

Figure 16-46 "Always" Source Defaulting the Drawer Model URL Template



As an alternative, the P11_DIALOG_MODAL_URL_TEMPLATE uses a Pre-Rendering computation. The figure shows the P11_DIALOG_MODEL_URL_TEMPLATE computation selected in the component tree, and highlights the APEX_PAGE.GET_URL expression described above that generates its URL template value.

Figure 16-47 Computation Defaulting the Drawer Model URL Template