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

179
Views
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
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!