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

212
Views
How to use Formik's handleChange multiple times to change the same value?

I use Material-UI and Formik. I want that two input fields can edit a single value. In this case there is a TextField and a Slider and both of those inputs should allow to change the value for the perdiod. When I give both input fields the same id I get the following error message, which I kinda expected: Formik cannot determine which value to update

But is there a way to do that with Formik or do I need to write a custom handleChange function?

const formik = useFormik({
    initialValues: {
      period: 5,
    },
<OutlinedInput
 id="period"
 name="period"
 type="period"
 onChange={formik.handleChange}
 value={formik.values.period}
/>


<Slider 
  value={formik.values.period}
  aria-label="Default" 
  min={0}
  max={20}
  id="period"
  onChange={formik.handleChange}
/>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

dont give them the same id , but give them the same name

about 4 years ago · Juan Pablo Isaza Report
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!