Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

202
Views
Sí, no se valida cuando se cumplen las condiciones.

Tengo campos adicionales que solo se muestran si se selecciona una casilla de verificación (el valor booleano es verdadero). Estos campos adicionales también necesitan validación, pero usar el método .when() no parece reaccionar a que la casilla de verificación sea verdadera como condición. La parte de validación de mi código se ve así:

 const schema = useMemo( () => yup .object() .shape({ type: yup .string() .label(translate('Forms.EmailForm.type.label')) .required(), person: yup .object() .shape({ firstName: yup .string() .required() .trim() .min(1) .max(255) .label( translate( 'Forms.EmailForm.firstName.label', ), ), hasAddress: yup.boolean(), address: yup.boolean().when('hasAddress', { is: true, then: yup .object() .shape({ firstLine: yup .string() .required() .max(255) .label( translate( 'Forms.EmailForm.address.firstLine.label', ), ), secondLine: yup .string() .max(255) .label( translate( 'Forms.EmailForm.address.secondLine.label', ), ), }), }), }), }), [], ); const form = useForm<EmailForm>({ resolver: yupResolver(schema), defaultValues: { type: 'PERSON', }, });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!