Formik: Formik Validation Yup error message: Change field name

Created on 29 Mar 2018  路  2Comments  路  Source: formium/formik

Bug, Feature, or Question?

Question

Current Behavior

if id="maxInterest"
The error message will show the id name: maxInterest is required.

Desired Behavior

if id="maxInterest"
The error message will show the id name: Max interest is required.
Some way to specify the field name in the error message.

Suggested Solutions


In the validationSchema allowing a name to be specified for each input.

  • Formik Version: formik": "^0.11.11",
  • React Version: "react": "^16.2.0",
  • OS: MacOS
  • Node Version: v8
  • Package Manager and Version: Yarn

Most helpful comment

Yup has .label('Different name')
https://github.com/jquense/yup#mixedlabellabel-string-schema

Example:

Yup.number().label('Amount').moreThan(0).required()

All 2 comments

Not sure, this is a Yup-related question so I would ask it there.

Yup has .label('Different name')
https://github.com/jquense/yup#mixedlabellabel-string-schema

Example:

Yup.number().label('Amount').moreThan(0).required()
Was this page helpful?
0 / 5 - 0 ratings

Related issues

giulioambrogi picture giulioambrogi  路  3Comments

outaTiME picture outaTiME  路  3Comments

jeffbski picture jeffbski  路  3Comments

jaredpalmer picture jaredpalmer  路  3Comments

green-pickle picture green-pickle  路  3Comments