Skip to main content

Read Only Conditions - Always and Never

Do you know any real use case for condition type "Never"? Do you know what is the difference between NOT SELECTING ANY read only condition and selecting option "Always"? If your answer is "No" to either of these questions, then you may find this blog post useful.

Read Only Condition:

You can specify read-only condition at Page Level, Region Level or at Item Level. Read Only condition specified at page level applies to entire page. When the condition is met, all the items rendered on the page (including items from global page) will be displayed as read-only. Similarly, Read Only condition specified at region level applies to all items defined under that page.

Advantages of using "Read Only" condition:

  1. Rendering: APEX automatically takes care how to display items in read only mode and what data to display. For e.g. for LOV based items, APEX will automatically display "Display" value.
  2. Security: When Item is read only, users should not be able to modify item value in any way. If we try to modify item value using JS and tries to submit page, then we get below error

"Read Only" condition "Never":

What if you want one page item (or set of page items) to be always displayed as editable, irrespective of read only condition it inherits from region/page level? for e.g. may be a "Search" input item or "Comments" item? In this case, all you need to so is, set "Read Only" condition of this item as "Never". When we specify  "Read Only" condition as "Never" APEX will NEVER renders the page item as read only.

"Read Only" condition "Always":

As you can easily guess, when we set  Read Only condition as "Always" for any item, it will be rendered as read-only irrespective of read only condition it inherits from region/page level. This is useful for data which should not be editable, in any condition, by any user, from the given APEX Page. We could also consider using "Display Only" item type in these cases as an alternative to "always" read-only item.

One main difference between "Display Only" item and item defined with "always" read-only is, "Display only" item has control to specify whether you want to include page item value on page submit or not where as Read-Only item values are always submitted.

Here is the link to demo page where you can observe above points discussed.

APEX Versions: 18.1,18.2 and 19.1

Thank you.




Comments

Vincent said…
Nice article, Hari, well explained and organized!

and about what you mentioned:

The difference between the"Display Only" item and the item defined with "always" read-only is whether you could control the page item values included in submitting page, did you mean by the "Query Only" property or some other properties?
Hari said…
Hi Vincent,

No, "Query Only" property is specific to items that are part of "Form" region only. This property, you can see under "Source" section. For display-only items, under "Settings" section, we can see "Send On Page Submit" property. I am talking about this property in the above post. Please read help text available in page designer for differences between these two properties.

Regards,
Srihari

Popular posts from this blog

Interactive Grid - Conditional Enable/Disable

In this blogpost, I am going to discuss few approaches using which we can conditionally enable/disable Interactive Grid (IG) column(s) based on other column(s) values. Note:    There is a bug  30801170  in APEX 19.2/20.1 with respect to "enable/disable" dynamic actions for IG columns. Workaround for this bug is provided at the end of this blogpost . This bug has been fixed in APEX version 20.2. Client Side Only Conditions If conditions to enable/disable are simple, then we can check those conditions easily on the client side. For e.g. let's consider IG on EMP table with following SQL Query. SELECT EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO FROM EMP Let's consider the requirement as - Enable "Commission" column only when JOB is equals to 'SALESMAN' and disable "Commission" column in all other cases. This can be done declaratively using dynamic actions (DA) DA "Enable/Disable Commission - 1" Create DA and give it a prope

Interactive Grid - Bulk Operation on Selected Rows

What's the Problem? Let's say you have an IG on employee table and you want to update selected employees commission based on user's input. Ideally, it should be very simple, where you can write UPDATE statement in page process and select IG region as "Editable Region" under "Execution Options" of the page process. But, when you select rows and submit page, you can see that, this process won't get executed! The reason is  Selection of 'Row Selector' check-boxes is not considered as row-change. Thus selected rows are not submitted to server. So, is there any work around?  Yes! Luckily there are lot of JavaScript (JS) APIs available to work with IG. If you are not already aware, you can refer "APEX IG Cookbook"  or  JavaScript API Reference documentation. If we continue with above Employee IG example, when user selects IG rows, enters "Commission %" and clicks on "Update Commission" button, then we can writ

Few tips on Gantt Charts

Oracle APEX offers several beautiful chart types which are based on Oracle JET Data Visualizations. Gantt Chart is one such beautiful and useful chart. However, when I have searched in Google for some help on Gantt Charts, there are not many blogs posts talking about it. So, I thought, I could write one with few basic tips which I have learned this year. I have used Gantt Chart to display employees calendar data and my targeted output was something like below. Pic-1 Looks simple, correct? However, it's little tricky to get there. Multiple Tasks Per Row: When I look at the output, first I thought, I will have to write a query which gives tasks data and employee data with 1 row per task. That is, if there are 10 tasks to be displayed, then there should be 10 rows in SQL query output. But, it's not correct. Instead, I should have 1 row for each task + 1 row for each employee (parent). So I need to write a query which will output data in below format. Pic-2 A