Skip to content

Make checkedValue and uncheckedValue mandatory for Checkbox component #1874

Description

@vdua

Problem

The checkbox component definition marks checkedValue and uncheckedValue as required: false with no default value. This means a checkbox can be authored and validated successfully without specifying what value it submits when checked or unchecked.

When neither property is set, AEM Core Components fall back to submitting the HTML default "on" when the checkbox is ticked. This is silent and non-obvious — the form validates, the field renders, and required: true guards against skipping it, but the submitted value is undefined/unpredictable unless the author explicitly sets checkedValue.

Impact

  • Form authors can create checkbox fields that pass schema validation but submit an implementation-specific default ("on") instead of a meaningful domain value (e.g. "true", "agreed").
  • Back-end submission processors that check for a specific string value will silently miss, with no authoring-time warning.
  • Tooling that generates component payloads from a spec (e.g. AI-assisted authoring) has no signal to prompt for these values.

Proposed Solution

Mark checkedValue as required: true in the checkbox component definition. Optionally also require uncheckedValue when enableUncheckedValue is true.

This would cause validate-patch and the AEM dialog to surface missing values at authoring time rather than silently falling back to "on".

Component

core/fd/components/form/checkbox/v1/checkbox
Definition field: ./checkedValue — currently required: false, no default

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions