Replies: 3 comments 7 replies
-
hi @chrishj59, yes I agree, have you got a chance to take a look schema validation? and perhaps you can write your own logic with validation resolved as well: let me know your thoughts. |
Beta Was this translation helpful? Give feedback.
-
@bluebill1049 is it possible to mix the yup schema validation with a custom validation. I tried using the resolver but it overrides the schema validation. I saw you are working on a resolvers package for v6 but is itt possible to have this for v5? So pretty much what I need is to add some custom logic to add some errors on top of the errors I have that comes from the validation schema |
Beta Was this translation helpful? Give feedback.
-
Hi @chrishj59 , @bluebill1049 , @tafelito I am also looking for this functionality - whole-form validation in addition to per-field. Options I have considered:
Options for RHF:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When validating a form it is often necessary to validate the individual fields but in addition, it is often necessary to validate fields in relation to each other.
For example, when creating a user account it is necessary to validate both the password and repeat passwords are entered and match complexity. This is handled well using the register validation methods.
When each field has been entered it is also necessary to check the values of both are the same. This may also apply where the form has a total quantity field and a quality for each line included in the form. Here is it necessary to check the total of the lines equals the summary total.
Describe the solution you'd like
A new hook should be provided to apply a final check on the whole form activated as a pre-submit step. If an error is returned the submit should not be fired. - Similar to the field validation.
Describe alternatives you've considered
I have attempted to have a validation set in the register each field and call the field validation as part of setValue - Final parameter and then to have a form validation resolver with a mode 'onSubmit'. The field validators are not called only the validation resolver.
Beta Was this translation helpful? Give feedback.
All reactions