Open kimroen opened 1 week ago
As one might expect, this is because when there's more than one error from ajv, we're just passing through the errors directly, concatenated with " and "
.
This happens here:
This calls the function ajvErrorsToOneFormError
:
Here, if there's just one error we transform it into a sensible FormError
instance with extracted information, but if there are more then we fall back to some fairly simple behavior where we extract message
and concat them all together:
I made this codesandbox where you can enter some text and see what the error objects look like (as well as replicating the concatenation behavior that leads to this error message):
Now, I suppose the question is: What should it do instead?
Do we want it to combine multiple errors into one, or should we display multiple errors? Should we make ajv stop on the first error to avoid this all together (this matches the behavior of passing both a schema and validate function, for instance)?
🐛 Bug Report
When rendering a field with multiple validation props, a combined error message is shown. Example:
This error message has multiple problems:
Here's an example from our application:
To Reproduce
Here is a CodeSandbox demonstrating the issue
Expected behavior
The error message is displayed in Norwegian or English, depending on the set language. As a bonus, It would be nice to be able to customize (showing the pattern isn't great, for instance)
Eufemia Version
Browser JS: 10.51.1
Browser CSS: 10.51.1