How to reliably determine if Section is in read-only mode

We have Sections embedded within other Sections and some of those have repeating lists. This is mostly done via Repeating Dynamic Layouts. Many of these Sections and lists are reusable and we have need to reuse them in both read-only and editable mode.

For embedded Sections set to read-only mode, all the input fields properly show up as read-only but we need to manually hide the action fields (buttons, links, etc). I see other posts that suggest to use the When rule pxIsEditable but that is woefully unreliable in my testing. That seems to only work for the first embedded Section but nothing beyond that.

My Section chain is as follows:

  1. Section A includes embedded Section B, set to always read-only.
  2. Section B includes embedded Section C, set to always read-only. Section C is dynamic and determined via a Property value.
  3. Section C displays input fields (text inputs, dropdowns, etc) and action fields (links and buttons). It also includes embedded repeating layouts.

Section C and beyond input fields all properly show up as read-only, except buttons and links which still show up as visible even when the Visibility is set to Condition (when rule) using pxIsEditable.

Duplicating most of our application to hard-code a read-only version of each Section just so we can hide buttons and links is not acceptable. Please help!

What can I do to reliably determine if the current Section is in read-only mode?

@Hermy64 Hello,

Please find below steps. Hope it would help.

  1. We have to create two parent sections one for read-only and one for editable display.(In this way we are only duplicating one section not all)

  2. For all the child section fields(properties), make Editable option set to Auto in the presentation tab.

  3. In the read-only parent section, drag Embedded section , refer section name and set Editable option to read-only always in the presentation tab and for Editable parent section drag embedded section and make editable option to Auto in presentation tab.

  4. For Button visibility, if we make the section as read-only then the when rule pxIsEditable returns false.

@SairamK13

Thank you for the reply. However, these suggestions were already in practice or don’t work.

  1. If I understand your meaning then this is how my embedded Sections are already set up. See my Section chain below.

  2. All the fields are already set up to use Auto for the Edit Option. There are no issues with the input fields. The issue is with Links and Buttons because pxIsEditable does not work properly in my experience.

  3. This is how it is currently set up. There are no issues with the input fields. The issue is with Links and Buttons because pxIsEditable does not work properly for repeating layouts.

  4. There are no issues with the input fields. The issue is with Links and Buttons because pxIsEditable does not work properly for repeating layouts (or at all it seems, see below).

In other words, in one embedded Section I have an input text field and a button. The text field is ready only but the button is still visible even when I use “pxIsEditable” as the Visibility When condition on it. Note, I’ve also tried copying the condition from the When rule directly in to the Visibility for the field and got the same result.

Actually I just tried debugging by using pxIsEditable to display a label and it also never worked. No matter how the calling Section was configured pxIsEditable always resolved to false, even in the top-most/first embedded Section.

My Section chain is as follows:

  1. Section A includes embedded Section B, set to always read-only.
  2. Section B includes embedded Section C, set to always read-only. Section C is dynamic and determined via a Property value.
  3. Section C displays fields and includes embedded repeating layouts.

Section C and beyond input fields all properly show up as read-only, except buttons and links which still show up as visible even when the Visibility is set to Condition (when rule) using pxIsEditable.

@Hermy64

I’m still looking for an answer to this.

@Hermy64

This is a known limitation. Instead of ‘pxIsEditable’ when condition, you can try “!$input-Enabled”.

@RoryD999

“!$input-enabled” seems to work. Thanks a ton!

I don’t really know what that is but do you know any other secret codes like that?

@Hermy64

Glad I could help! I’m fairly certain that syntax is how Pega can reference the CSS to see if a given section is allowed to receive input or not.