The APEX Util button retrieves and displays the session state values stored using apex_util.get_session_state().
Implementation Steps
Set the Button Action to Defined by Dynamic Action.
Create a Dynamic Action with the following attributes:
Event: Click
Action: Execute PL/SQL Code
PL/SQL Code:
DECLARE
v_fname VARCHAR2(100);
v_lname VARCHAR2(100);
BEGIN
v_fname := apex_util.get_session_state('P1_FNAME');
v_lname := apex_util.get_session_state('P1_LNAME');
apex_debug.info('Stored First Name: ' || v_fname);
apex_debug.info('Stored Last Name: ' || v_lname);
END;
This logs the stored values in the APEX debug console for troubleshooting and validation.
This tutorial demonstrated different ways to interact with text fields and buttons in Oracle APEX. The buttons use various techniques, including session state management, page submission, dynamic SQL execution, JavaScript manipulation, and APEX utilities.
Each method serves a specific purpose:
Clear Session: Clears values from session state.
Submit: Submits the page.
APEX Submit: Stores values in session state before submission.
Dynamic SQL: Executes SQL dynamically.
Dynamic JS: Modifies text fields with JavaScript.
APEX Util: Retrieves stored session values for debugging.
By combining these methods, you can create highly interactive and dynamic APEX applications.
EXAMPLE:
In this application we have two text fields and 6 buttons:
Text fields
FName
LName
Buttons
Clear Session
Submit
Apex Submit
Dynamic SQl
Dynamic JS
Apex Util
ClearSessions Button
Create button named “Clear Session”
Create a Dynamic Action
On the true Branch
Create a second True Branch
Via Submit Button
Via APEX Submit
Via Dynamic SQL
Create a Dynamic Action
In the true branch
In the Processing tab
With the following values
Via Dynamic JavaScript
At the page level
Create a dynamic action
In the True branch
Via App Util
Viewing the session values
At the bottom of your page select Session > View Session variables
In this example the session variables are EMPTY, but had we had any data, it would display under Item Values.
After the session is cleared
No comments:
Post a Comment