Formik: How to call a function in onChange function along with the handleChange

Created on 29 Apr 2019  路  2Comments  路  Source: formium/formik

**Here i want to call a function in onChange along with the handleChange is there any way call it.**                    

                 <Input type="select"
                                  name="test"
                                  id="test"
                                  valid={!errors.test}
                                  invalid={touched.test&& !!errors.test}
                                  required
                                  onChange={(e) => {
                                   handleChange;
                                    this.getAudioes(values)
                                  }}
                                  onBlur={handleBlur}
                                  value={values.test}  >
              <Input type="select"
                                  name="test2"
                                  id="test2"
                                  valid={!errors.test2}
                                  invalid={touched.test2&& !!errors.test2}
                                  required
                                  onChange={(e) => {
                                   handleChange;
                                    this.getAudioes(values)
                                  }}
                                  onBlur={handleBlur}
                                  value={values.test2}  >

Most helpful comment

<Input
    onChange={(e) => {
        handleChange(e);
        this.getAudioes(values);
    }}
    ... 
/>

All 2 comments

you can get handleChange in props, such as:

handleChange = (e) => {
    const { field: { onChange } } = this.props
    const promise = Promise.resolve(onChange(e))
    promise.then(() => console.log(this.props.form.values))
  }
<Input
    onChange={(e) => {
        handleChange(e);
        this.getAudioes(values);
    }}
    ... 
/>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaredpalmer picture jaredpalmer  路  3Comments

najisawas picture najisawas  路  3Comments

jeffbski picture jeffbski  路  3Comments

PeerHartmann picture PeerHartmann  路  3Comments

ancashoria picture ancashoria  路  3Comments