rules repository

A-3090 Never mark Interactive Grid columns with the is-readonly class as required.

Severity Warning SQL-based Test Free New

Reason

The CSS class is-readonly stops users from editing a grid cell, but the server does not know about it: a Value Required column is still validated. For new rows, or rows where the value is empty, users get a "value required" error on save and have no way to enter the value.

Remove Value Required from the column, or give it a default value (a column with a default is not reported). If the column must be required, make it editable instead of hiding the input behind is-readonly. For a column that is read-only for good, prefer Query Only or a Read Only condition.

Example

Non-Compliant Example

page 10 (
    // ...
    region orders (
        name: Orders
        // ...
        advanced {
            htmlDomId: orders
        }

        column CREATED_BY (
            type: textField
            // ...
            appearance {
                cssClasses: is-readonly
            }
            validation {
                valueRequired: true
            }
        )
    )
)
Issues
LineColumnMessage
1732Column is read-only by its is-readonly CSS class but marked as required.

Compliant Solution - ★★★★★

page 10 (
    // ...
    region orders (
        name: Orders
        // ...
        advanced {
            htmlDomId: orders
        }

        column CREATED_BY (
            type: textField
            // ...
            appearance {
                cssClasses: is-readonly
            }
        )
    )
)

Tests

Test SQL query

select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || coalesce(r.static_id, to_char(r.region_id)) || '.' || c.name as identifier,
       'Column ' || c.name || ' of Interactive Grid ' || c.region_name || ' on page ' || c.page_id || ' of app ' || aa.alias
         || ' in ' || aa.workspace || ' is read-only by its is-readonly CSS class but marked as required.' as message
  from apex_appl_page_ig_columns c
  join apex_application_page_regions r
    on r.application_id = c.application_id
       and r.region_id = c.region_id
  join apex_applications aa
    on aa.application_id = c.application_id
       and aa.workspace = c.workspace
 where aa.workspace in (#ApexWorkspaces#)
   and ' ' || c.value_css_classes || ' ' like '% is-readonly %'
   and c.is_required = 'Yes'
   and c.default_type_code is null
   and exists (select 1
                 from apex_appl_page_igs ig
                where ig.application_id = c.application_id
                  and ig.region_id = c.region_id
                  and ig.is_editable = 'Yes')

Test results

IdentifierMessageMigration
WORKSPACE.CUSTOMERS.10.orders.CREATED_BYColumn CREATED_BY of Interactive Grid Orders on page 10 of app CUSTOMERS in WORKSPACE is read-only by its is-readonly CSS class but marked as required.-

Parameters

Use parameters to customize the rule to your needs.

ParameterDescriptionDefault Value
ApexWorkspacesComma-separated List of APEX workspaces owning APEX applications to check.dblinter, dbl_gui

References