-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Open
Labels
[Package] DataViews/packages/dataviews/packages/dataviews[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Description
What
This is a tracking issue to break down the work on implementing validation in the Field API.
See related iteration issue that tracks improvements to the DataViews and DataForm components planned for WordPress 6.9 and the overview issues for DataViews #55083 and DataForm #59745.
Goals
Support a number of general validation rules leveraging the HTML standard. If/when we introduce domain-specific types (e.g., slug
), that would also support domain-specific validation. For the 1st iteration, we want to implement general validation, while supporting domain-specific validation via the isValid.custom
.
Support both sync and async custom
validation. In progress: controlled, uncontrolled.
Status
- not planned:
-
- need to be implemented: empty cell
- shipped: ✅
field types / validation rules | required | custom | pattern | min/max | elements[1] |
---|---|---|---|---|---|
array | - | - | #71194 | ||
boolean | ✅ | ✅ | - | - | |
date | - | range of dates | |||
datetime | - | range of dates | |||
✅ | ✅ | max=maxlength, min unsupported | |||
integer | ✅ | ✅ | - | controls the range of input | |
media | - | - | - | - | - |
password (field type to be implemented) | controls the length of input (min=minlength, max=maxlength) | ||||
telephone | ✅ | ✅ | - | ||
text | ✅ | ✅ | controls the length of input (min=minlength, max=maxlength) | ||
url (field type to be implemented) | - |
Notes:
- [1] The
elements
validation rule is something we have hardcoded in the custom function of some field types (example) and we aim to extract. In some contexts, the UI component would restrict already the inputs (e.g., via select component) but others would require to setelements: true
to make it so (e.g., ValidatedFormTokenField for array).
Metadata
Metadata
Assignees
Labels
[Package] DataViews/packages/dataviews/packages/dataviews[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.