Formik: field-level value parsing/onChange

Created on 27 Nov 2017  路  2Comments  路  Source: formium/formik

I'd like to be able to transform values as they are changed, e.g. coerce text field into a number. Seems the only option to do this with formik is to do all the value formatting in the form's onSubmit. Would be good if there were a way to inject a mapping function that's called each time an input value changes.

Most helpful comment

You can pass your own onChange handler, do what you need and programmatically call setFieldValue provided from Formik.

All 2 comments

You can pass your own onChange handler, do what you need and programmatically call setFieldValue provided from Formik.

@prichodko this is a reasonable workaround.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

green-pickle picture green-pickle  路  3Comments

dfee picture dfee  路  3Comments

jaredpalmer picture jaredpalmer  路  3Comments

ancashoria picture ancashoria  路  3Comments

jaredpalmer picture jaredpalmer  路  3Comments