Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
Is it possible to pass both custom validation function in validate and do yup/zod schema validation in React-hook-form

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

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda