How to handle zfd.repeatableOfType
with other zfd.
preprocessors
#400
Unanswered
RobertGemmaJr
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been having a lot of trouble combining
zfd.repeatableOfType
with some of the zfd preprocessors - in my casezfd.file
.Consider my schemas:
That builds the following schema and form component:
My issue is that I cannot correctly target my
ControlledFile
component for validation errors. In order to pass the files through the schema I need it's name to be${keys.files}
. However, when no file has been selected, the validation error does not appear on my UI.I've been able to determine that the validation error is being sent to
${keys.files}[0]
. I'm assuming the issue is that myFileSchema
is (correctly) preprocessing and validating the empty file toundefined
and, because it'sundefined
, returning that validation error. My only guess form here is thatzfd.repeatableOfType
is fielding the error from the "first" instance ofFileSchema
and thus passing the validation error's name as${keys.files}[0]
?Is there any way to get around this behavior? Or a way to pass validation errors to an "extra" field for any given input?
Beta Was this translation helpful? Give feedback.
All reactions