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

180
Visualizações
How to dynamically validate using Yup

Basically I got an input form, I want to show error if min length is not met.

I have a multiselect component that has input inside it, and on option select the input max length should change. I got this function that changes the refs value.

<Multiselect @select="makeMaxLength()" />
  function makeMaxLength() {
      const maxLength = passwordType().length
      maxPasswordLength.value = maxLength
      console.log(maxPasswordLength.value) // works fine and always shows new value
    }

even when the ref changes I keep getting this error passwordAnswer must be at most 0 characters

   const schema = yup.object().shape({
    passwordAnswer: yup.string().max(maxPasswordLength.value),
    });

I've tried this as well but here I get passwordAnswer must be at most [Function anonymous] characters

 const schema = yup.object().shape({
    passwordAnswer: yup.string().max(() => maxPasswordLength.value),
    });
about 4 years ago · Juan Pablo Isaza
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