Set Session State Value for Oracle APEX Page Item

1. Overview

This document talks about the setting session state value for page item using the JavaScript function in Oracle APEX.

2. Technologies and Tools Used

The following technologies have been used to achieve this functionality,

  •  JavaScript

3. Use Case

To set the session state value for page item without submitting the page.

Actually, there are many ways to achieve this scenario. Here, we have taken the JavaScript function to set the session state value.

4. Architecture 

Follow the steps to set the session state value using JS,

Step 1: Create a dummy application process(TO_SETSESSION_VAL) in the application shared component.

Step 2: Go to the target page and put the following code in the Function and Global Variable Declaration under the JavaScript section which will be available in the page property,

JS:       

//Use this function to set session state for page item

function setsessionvalue(itemnm){

    apex.server.process(

        “TO_SETSESSION_VAL”,

        {  

            pageItems: “#” + itemnm

        },

        {

            async: true, 

            “dataType”: “text”,

            “success”: function(pdata){

                void(0);

            }

        }

    );

}

Step 3: Finally, based on the scenario, call this function using button action / any JavaScript event

setsessionvalue(‘PX_PAGE_ITEM’);

Recent Posts