Resolve "Session State Protection Violation" Error in Oracle Apex

Resolve "Session State Protection Violation" Error in Oracle Apex

In Oracle Apex page, if you are having Display Only or Hidden page items or a page item whose Read-Only property is set to true. And you are updating the field values at runtime using the JavaScript, then on page submit you will face the "Session State Protection Violation" error.

The following are the examples to show you the solution for the "Session State Protection Violation" error in Oracle Apex.

Resolve Session State Protection Violation Error for Display Only and Read-Only items

We use Display Only and Read Only items so that the user can not edit the field values at runtime. But if you are updating the values programmatically using the JavaScript then rather than setting it from Oracle Apex as Display only or Read-only, it is better to set it using the JavaScript.

In the below example, it will set the page item P3_COMMISSION_PCT is read-only. Add this JavaScript code for your page items in your page properties Executes when page load section.

document.getElementById("P3_COMMISSION_PCT").readOnly = true;

Resolve Session State Protection Violation Error in Oracle Apex for Hidden Items

For the Hidden page items, set its Value Protected Property to No or Turn off the switch. As shown in the below image:

Hidden page item.

Check more on JavaScript for Input.

Related Tutorials:

Oracle Apex: Display Custom Error Messages from PL/SQL Process

This Post Has 4 Comments

  1. Luis Godoy

    Thanks for sharing, the solution is so simple and very useful

  2. shaikrvn

    Hello,

    in our case we have Display only column in IG and tried the above JS code but it displays the session error.

    COLUMN36: it is a 'Display Only' column with

    • server side condition to display/hide conditionally
    • Heading with &ITEM_P36. (where in the ITEM_P36 is hidden and value protected set to 'No'

    while Saving the IG post changes it errors out with the session error.

    any ideas/suggestions would be appreciated.

    Thanks

  3. Alex2011
    document.getElementById("P3_COMMISSION_PCT").readOnly = true;
    

    hello,is not a correct way, because the end users are be able to change the value by browser console with java script code and change the value and send it to database.
    I have same issue and I couldn't find any way for solving this problem.

  4. Hector Lopez

    Thank you!

Comments are closed.