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

255
Visualizações
Need to reference/access Yup.ref() value within the message of yup min and max validations

I have the following Yup validation and unsure how to reference the Yup.ref(a) value within the message of that .min() and .max(), i.e.:

  checkPercent: Yup.number()
    .when("summaryFlag", {
      is: true,
      then: Yup.number()
        .typeError('Value must be a number')
        .required('Value is required')
        .positive()
        .min(Yup.ref("percentLower"), `{The value must be > xx`)
        .max(Yup.ref("percentUpper"), `{The value must be < yy`)
  })

Using the above, how can I replace xx in my .min message with the actual value of Yup.ref("percentLower") ?

The same for yy to be replaced with the value of Yup.ref("percentUpper") ?

I tried using template literals syntax but it didn't work, i.e.:

.min(Yup.ref("percentLower"), {The value must be > ${Yup.ref("percentLower")})

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