You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use form.validate.getButtonProps to validate a complete fieldset, i.e. a field that consists only of nested fields.
The validation will produce the errors of the subfields, but it since for the fieldset field no value is submitted, it will never land in the list of validatedFields, and thus not have any errors assigned.
I would have expected that validating a nested object field causes all subfields of this field to be validated, and have their errors reported.
Suggestion
When sending a validate intent, always validate all fields for which the field name is a prefix.
Or, make it configurable with a recursive flag on the ValidationIntent payload
I've added two buttons to the ToDo List example, a "Validate Task" button, which triggers the described behaviour (of not doing anything, basically).
For comparison, there is also a "Validate Task Content" button, which works as expected.
Steps
Click on Todo list
Click on Add task
Click on Validate Task
I would have expected the task content to become red
Click on Validate Task Content
This works, but it validates only one leaf field
But there is no way to validate an entire field with subfields.
What browsers are you seeing the problem on?
No response
Screenshots or Videos
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
oxc
changed the title
Cannot validate nested object fields
Cannot validate complete nested object
Nov 29, 2024
Describe the bug and the expected behavior
I'm trying to use
form.validate.getButtonProps
to validate a complete fieldset, i.e. a field that consists only of nested fields.The validation will produce the errors of the subfields, but it since for the fieldset field no value is submitted, it will never land in the list of validatedFields, and thus not have any errors assigned.
I would have expected that validating a nested object field causes all subfields of this field to be validated, and have their errors reported.
Suggestion
When sending a validate intent, always validate all fields for which the field name is a prefix.
Or, make it configurable with a
recursive
flag on the ValidationIntent payloadConform version
v1.2.2
Steps to Reproduce the Bug or Issue
Here is a sandbox that demonstrates the problem:
https://codesandbox.io/p/devbox/smoosh-frost-gf79qd?workspaceId=1702db6b-2042-4a59-957b-ee67bb3c5948
I've added two buttons to the ToDo List example, a "Validate Task" button, which triggers the described behaviour (of not doing anything, basically).
For comparison, there is also a "Validate Task Content" button, which works as expected.
Steps
But there is no way to validate an entire field with subfields.
What browsers are you seeing the problem on?
No response
Screenshots or Videos
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: