Is it possible to execute both custom validation function which will be passed to validate object in react hook form and yup/ zod schema validation ?
I have a custom rules object from where I would pick up few rules which will be complex validations along with this I would need a regular yup/zod schema validation.
When I run a simple sample, my custom validations won't work if schema is given.
My custom validate function is below, this is just an example. In actual these validate functions will be quite complex and will be in some common file where it will be reused.
<Controller
name="retype_password"
control={control}
rules={{ validate: {isValueEqual: ruleSet.isValueEqual(getValues('password')) } }}
// Run this custom function along with schema validation like string, required, min , max
render={({ field, fieldState: {error}, formState }) =>
<MyTextField placeholder="Retype password here" error={!!error} {...field} />
}
/>
Please guide, will be really helpful & appreciated
Thank you