13.1.1 Understanding Page Items

An item is part of an HTML form such as a checkbox, date picker, file browse field, popup list of values (LOV), select list, shuttle, flip toggle switch, text field, text area, and so on.

When defining an item, developers must follow defined naming conventions and follow specific rules when referencing item values stored in session state.

See Also:

About Item Types About the Differences Between Page Items and Application Items

Page items are placed on a page and have associated user interface properties and Application items are not associated with a page.

There are two types of items: page items and application items. Page items are placed on a page and have associated user interface properties, such as Display Only, Label and Label Template. Examples of page items include a checkbox, date picker, display as text, file browse field, popup list of values, select list, or a text area. In contrast Application items are not associated with a page and therefore have no user interface properties. You can use an application item as a global variable. About Item Naming Conventions

When creating an item name, developers must follow very specific item naming conventions.

When specifying an item name, remember the following rules. Item names must:

  • Be unique within an application.
  • Not include quotation marks.
  • Begin with a letter or a number, and subsequent characters can be letters, numbers, or underscore characters.
  • Be case-insensitive.
  • Should not exceed 30 characters. Items longer than 30 characters cannot be referenced using bind variable syntax. See Referencing Session State Using Bind Variable Syntax.
  • Cannot contain letters outside the base ASCII character set.

As a best practice Oracle recommends including the page number when naming items. By default, wizards prefix page item names with P<page no>_<item name> (for example, P1_NAME). Referencing Item Values

You can reference item values stored in session state in regions, computations, processes, validation, and branches.

Table 13-1 describes the supported syntax for referencing item values.

Table 13-1 Syntax for Referencing Item Values

Type Syntax Description



Standard bind variable syntax for items whose names are no longer than 30 bytes. Use this syntax for references within a SQL query and within PL/SQL code.



PL/SQL syntax referencing the item value using the V function. Use this syntax in PL/SQL code of packages or stored procedures and functions.

Avoid this syntax in SQL statements. It may result in performance problems.



Standard PL/SQL syntax referencing the numeric item value using the NV function. Use this syntax in PL/SQL code of packages or stored procedures and functions.

Avoid this syntax in SQL statements. It may result in performance problems.

Static Text (exact)


Static text. Exact Substitution.

Note: Exact substitution syntax should be avoided in SQL or PL/SQL code because it can result in SQL Injection vulnerabilities.

You can set the value of an item in your application using any of the following methods:

  • For page items, use the Source Attribute to set the item value.

    From the page, select the item name to view the Edit Page Item page. Scroll down to Source and edit the appropriate fields.

    You can also set the value of an item in any region based on PL/SQL or a process using the following syntax:

     :MY_ITEM :=  'new value';
  • Pass the value on a URL reference using f?p syntax. For example:

  • Set the value using a computation. Computations are designed to set item values. For example:

    TO_CHAR(SYSDATE,'Day DD Month, YYYY');
  • Use the PL/SQL API to set an item value within a PL/SQL context. For example:

    APEX_UTIL.SET_SESSION_STATE('MY_ITEM',SYSDATE); About Referencing Items Using JavaScript

When you reference an item, the best approach is to reference by ID.

If you view the HTML source of an Oracle APEX page in a web browser, you would notice that all items have an id attribute. This ID corresponds to the name of the item, not the item label. For example, if you create an item with the name P1_FIRST_NAME and a label of First Name, the ID is P1_FIRST_NAME.

You can get and set item attributes and values using the JavaScript functions $v('P1_FIRST_NAME') and $s('P1_FIRST_NAME', 'Joe');. Consider the following example:

function showFirstName(){
  alert('First Name is ' +$v('P1_FIRST_NAME'))
function setFirstName(pFirstName){
  $s('P1_FIRST_NAME', pFirstName);

These functions can be called by other JavaScript functions or with the Execute JavaScript code dynamic action.

See Also:

APEX_JAVASCRIPT in Oracle APEX API Reference Working with Multiple Select List Item

Learn how to handle values returned from a multiple select list item. About Handling Values Returned from a Multiple Select List Item

A multiple select item renders as a multiple select list form element which can be either a Multiselect List or Shuttle item type. When submitted, selected values are returned in a single colon-delimited string. You can handle values in this format in three ways:

  • Using the INSTR function

  • Using the APEX_STRING.SPLIT function

  • Creating a shuttle Using APEX_UTIL.STRING_TO_TABLE to Convert Selected Values

Suppose you had a report on the EMP and DEPT tables that is limited by the departments selected from a Department multiple select list. First, you create the multiple select item, P1_DEPTNO, using the following query:

SELECT dname, deptno
FROM dept

Second, you return only those employees within the selected departments as follows:

SELECT ename, job, sal, comm, dname
FROM emp e, dept d
WHERE d.deptno = e.deptno
AND instr(':'||:P1_DEPTNO||':',':'||e.deptno||':') > 0

Next, assume you want to programmatically step through the values selected in the multiple select item, P1_DEPTNO. To accomplish this task, convert the colon-delimited string into a PL/SQL array using the apex_string.split function. The following example demonstrates how to insert the selected departments into an audit table containing the date of the query.

  l_selected apex_t_varchar2;
  -- Convert the colon separated string of values into
  -- a PL/SQL array
  l_selected := apex_string.split(
                    p_str => :P1_DEPTNO,
                    p_sep => ':' );

  -- Loop over array to insert department numbers and sysdate

  FOR i IN 1..l_selected.count
    INSERT INTO report_audit_table (report_date, selected_department)
        VALUES (sysdate, l_selected(i));

See Also:

STRING_TO_TABLE Function in Oracle APEX API Reference