Multiple Errors inside a single validation #741
-
Hello! I was wondering if there is a way to receive more than one error message from each validation. <Form.Field
name="password"
validators={{
onChange: z
.string()
.min(3, 'Password must have 3 letters or more')
.includes('a', { message: 'Password must include letter a' })
}}>
{field => (
<Input
errors={field.state.meta.errors}
placeholder={field.name}
value={field.state.value}
onChangeText={value => field.handleChange(value)}
onBlur={field.handleBlur}
/>
)}
</Form.Field> when the validation fails in both conditions i get a single error with the two messages split by a comma like this: what i would like is to get is an array with both messages so i could present them in a list format. I could split the message at the comma but that would prohibit me from using commas in the error messages Thanks for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey! As you noticed adapters are currently doing a join on the errors and returning a single string. |
Beta Was this translation helpful? Give feedback.
Hey!
As you noticed adapters are currently doing a join on the errors and returning a single string.
There's an open issue to give more control about the returned errors -> #667