Setting subfield-level errors from an array field's validator? #1792
Unanswered
adamkangas
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm aware that we can return field-level errors from validators on our
FormApi
– but I was wondering what thoughts were on returning subfield-level errors on aFieldApi
's validators whenmode="array"
is set.In my case, users are building a list of proposed room bookings and we need to validate the entire proposed array simultaneously whenever it changes – looking for conflicts with existing bookings in the database, but also ensuring that the proposals don't conflict with themselves.
It would be handy to add an
onChangeAsync
toproposedBookings
that can directly set multiple subfield errors likeproposedBookings[0].startDatetime
andproposedBookings[2].venue
Again, I know I can handle this at the form level, but this form is quite complex and I'd prefer not to fire off async requests when unrelated fields are changed. Any other approaches that might be recommended?
Beta Was this translation helpful? Give feedback.
All reactions