jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
34k stars 2.79k forks source link

Formik Validation #3964

Open AbdulrahmanM0 opened 7 months ago

AbdulrahmanM0 commented 7 months ago

setFieldError not working

   function handleError(){

    if(reverse_auto.length === Object.keys(props.values.columns).length){
        if(sum(Object.values(props.values.columns)) > props.values.total_width){
             props.setFieldError('exceed', "* total width of columns must not exceed Total width");
        }
        if(sum(Object.values(props.values.columns)) < props.values.total_width){
            props.setFieldError('less', "* total width of columns must not be less than Total width");
        }
    }
  }

Bug report

Current Behavior

Expected behavior

Reproducible example

Suggested solution(s)

Additional context

Your environment

Software Version(s)
Formik
React
TypeScript
Browser
npm/Yarn
Operating System
erashu212 commented 6 months ago

Please share codesandbox