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 tried to work around this by just returning an array of [null, null, 'Error here!'], but the errors property returned by useForm() returns the first element/does not return the array at all:
function validateFieldArray(value) {
let result = []
for (let i = 0; i < value.length; i++) {
if (!value[i].trim().length) {
result[i] = 'This field is required!'
}
}
console.log(result) // [empty, empty, 'This field is required!']
// returning true means no error
return !result.length ? true : result
}
const validationSchema = {
fieldArray: validateFieldArray,
}
// errors object comes back empty {}
Requested Solution: implement support for custom validator functions (no yup/zod) for field arrays, or let errors object pass arrays as error messages
The text was updated successfully, but these errors were encountered:
As of this moment, custom validator functions do not work with field arrays.
The upper passage does not work.
I tried to work around this by just returning an array of
[null, null, 'Error here!']
, but theerrors
property returned byuseForm()
returns the first element/does not return the array at all:Requested Solution: implement support for custom validator functions (no yup/zod) for field arrays, or let
errors
object pass arrays as error messagesThe text was updated successfully, but these errors were encountered: