-
-
Notifications
You must be signed in to change notification settings - Fork 244
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
SelectField
in tag mode doesn't show error massage
#985
Comments
Hi @danyhiol, and sorry for the delay. Could you create a reproduction using our CodeSandbox template? It'd let us check it much faster. |
Here is a simple reproduction link. |
Thanks! So, from what I can see, the problem is that these errors look like this: [
{ "name": "activities.0", "value": "x", "type": "minString", "min": 10, "message": "Activities must be at least 10 characters" },
{ "name": "activities.1", "value": "xxxxxxxxxx", "type": "regEx", "regExp": /*...*/, "message": "Activities must be a valid email address" }
] So the problem is that these are technically not errors of this component but its children. It's incorrect though, as it's responsible for these values. I'm not sure how to proceed on this one, as making these errors available to the parent field will break the rest, i.e., As a workaround, you can create a custom |
(We've had a team discussion about this issue, and here are the notes.)
|
Here's a proof of concept of the error extraction: const context = useField(props.name, {}, { absoluteName: true })[1];
const length = Array.isArray(props.value) ? props.value.length : 0;
const error = Array.from({ length }).reduce(
(error, _, field) =>
error ??
context.schema.getError(joinName(props.name, field), context.error),
props.error,
); However, it requires an additional |
SelectField
in tag mode doesn't show error massage
This is a follow-up to this issue.
When using
tag mode
withSelectField
withantd
, the field is validated, but the validation message is not shown as an inline error below the field.Please refer to the link for details.
The text was updated successfully, but these errors were encountered: