-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add support for elements validation in DataForm's array fields #71194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
000595e
Add support for validating elements
elazzabi cf015c5
Add validation input and how to
elazzabi 14e0308
Add array validation with required param
elazzabi 59ade44
Update validation logic to check if the token matches any available e…
elazzabi 1db0a20
Enhance validation logic to support array types by ensuring all value…
elazzabi b7b321a
Add tests for array and text field validations and validating against…
elazzabi 81d355f
Add categories field to DataFormValidationComponent with validation r…
elazzabi b3b0c28
Add ValidatedFormTokenControl component to enhance array input valida…
elazzabi 382cb4c
Enhance array validation logic to ensure elements are only checked if…
elazzabi 203af53
Refactor array control to support internationalization and improve va…
elazzabi a65e3b0
Add countries field to DataFormValidationComponent with validation ru…
elazzabi 538fc3a
Merge branch 'trunk' into add/elements-validation
elazzabi 8d5d551
Expose ValidatedFormTokenField from private API
elazzabi 0559f4c
Remove customValidation
elazzabi b3b0024
Import ValidatedFormTokenField and use it in Array
elazzabi fc42406
Add displayTransform and __experimentalRenderItem
elazzabi 6d527cd
Replace arrays for display const and remove unused findElementByValue
elazzabi 3f625d8
Adapt suggestions to pass values
elazzabi 53c83fd
Add customValidity and onFocus
elazzabi 822e31c
Add validation with validateTokens
elazzabi d24449b
Rename function
elazzabi 6617584
Add changelogs
elazzabi 75a0a5f
Change changelog for components
elazzabi fe03b3d
Call onInputChange after reseting the input
elazzabi 6ef2a57
Pass an onInputChange instead of onFocus
elazzabi 1a94d66
Merge branch 'add/elements-validation' of https://github.com/elazzabi…
elazzabi f2e301d
Remove validation for elements as it is replaced by control-level val…
elazzabi 27536bc
Add documentation for elements
elazzabi bc66855
Merge branch 'trunk' into add/elements-validation
elazzabi 300841d
Add changes to use the new getValue/setValue API
elazzabi 08f9b87
Remove validateToken from onChange
elazzabi a9872b2
Remove customInvalidMessage and messages
elazzabi 32b0d52
Fix linting
elazzabi 5ed466c
Moves changelog entries to Unreleased
elazzabi 20410e4
Remove input logic
oandregal 87c94f6
Update message by including tokens
elazzabi a4b1a3a
Merge branch 'trunk' into add/elements-validation
elazzabi ce7465f
Change order of changelog to reflect the timeline
elazzabi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Enhance array validation logic to ensure elements are only checked if…
… isValid elements is passed
- Loading branch information
commit 382cb4c09ec20e9e9552d004224d32ed80ca5e03
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given
isValid.elementsis implemented in validation.ts, do we still need it here? (same for any other field type)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this because, without it, the validation is run whenever the
elementsare present. Including when it is okay to add new elementsCleanShot.2025-08-22.at.15.23.13.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this code ever executed? I'd think we can remove it because it's covered by the control here, and so it never checks the custom validation here (that will run the same check again for elements).
There are a few levels to validation:
isItemValidutility: this handles element validation (this is for form-level).By introducing
isValid.elementsI understand that we can:isValid.custom)isValid.elementsproperly (done for the array control)isItemValidalso handles it (done)Does this make sense, or am I missing any context here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After seeing it closely, I agree that this part was inadvertently executed (as I recorded in the video), but it should be removed altogether f2e301d
Now that it is removed, and regarding this part:
I only see the
selectcontrol that might benefit from such validation. Should I implement it there, too?