rules repository

A-2430 Avoid page items without a label template.

Severity Warning SQL-based Test Free New

Reason

The label template renders the item's label, its required indicator, help and error messages, and links the label to the input for screen readers. Without a template the item is rendered bare and looks different from the other items, and the label markup the templates provide for accessibility is missing.

Assign a label template, for example Optional - Floating or Required - Floating. If the label must not be visible, use the Hidden template, which keeps the label for screen readers. Hidden items are not reported.

Example

Non-Compliant Example

page 10 (
    // ...
    pageItem P10_NAME (
        type: textField
        // ...
        // no appearance.template
    )
)
Issues
LineColumnMessage
314Page item has no label template.

Compliant Solution - ★★★★★

page 10 (
    // ...
    pageItem P10_NAME (
        type: textField
        // ...
        appearance {
            template: @/optional-floating
        }
    )
)

Tests

Test SQL query

select aa.workspace || '.' || aa.alias || '.' || i.page_id || '.' || i.item_name as identifier,
       'Item ' || i.item_name || ' on page ' || i.page_id || ' of app ' || aa.alias || ' in ' || aa.workspace
         || ' has no label template.' as message
  from apex_application_page_items i
  join apex_applications aa
    on aa.application_id = i.application_id
       and aa.workspace = i.workspace
 where aa.workspace in (#ApexWorkspaces#)
   and i.item_label_template is null
   and i.display_as_code != 'NATIVE_HIDDEN'

Test results

IdentifierMessageMigration
WORKSPACE.CUSTOMERS.10.P10_NAMEItem P10_NAME on page 10 of app CUSTOMERS in WORKSPACE has no label template.-

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