A-3190 Try to use a required label template for required page items.
Reason
Users should see that a field is mandatory before they submit the form. In Universal Theme the Required label templates (Required, Required - Above, Required - Floating) add the required indicator; the Optional ones do not. A required item with an optional label template only tells users after the failed submit.
Switch the item's label template to the matching Required variant. Items whose label is hidden on purpose (label template Hidden) are not reported. If a form marks mandatory fields another way, for example a notice that all fields are required, or uses its own required template whose name does not contain "Required", suppress the finding for those items.
Example
Non-Compliant Example
page 10 (
// ...
pageItem P10_EMAIL (
type: textField
// ...
appearance {
template: @/optional-floating
}
validation {
valueRequired: true
}
)
) | Line | Column | Message |
|---|---|---|
| 7 | 23 |
Compliant Solution - ★★★★★
page 10 (
// ...
pageItem P10_EMAIL (
type: textField
// ...
appearance {
template: @/required-floating
}
validation {
valueRequired: true
}
)
) 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
|| ' is required but uses the "' || i.item_label_template || '" 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.is_required = 'Yes'
and i.display_as_code != 'NATIVE_HIDDEN'
and i.item_label_template != 'Hidden'
and lower(i.item_label_template) not like '%required%'Test results
| Identifier | Message | Migration |
|---|---|---|
| WORKSPACE.CUSTOMERS.10.P10_EMAIL | Item P10_EMAIL on page 10 of app CUSTOMERS in WORKSPACE is required but uses the "Optional - Floating" label template. | - |
Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| ApexWorkspaces | Comma-separated List of APEX workspaces owning APEX applications to check. | dblinter, dbl_gui |
References
- same as UC-3190