Yup: Custom name for field

Created on 22 Aug 2019  路  2Comments  路  Source: jquense/yup

How I can change only name of field in error message ?

Most helpful comment

.label('whatever') I believe exists

All 2 comments

For example:

email: Yup.string().email('E-mail is not valid!').required('E-mail is required!'), password: Yup.string().min(6, 'Password has to be longer than 6 characters!').required('Password is required!')

In code above, I need to repeat for "E-mail" and "Password". It will be cool to have an method to setFiledLabel("E-mail or Username") or setCustomName("E-mail or Username") ... and keep default error messages.

.label('whatever') I believe exists

Was this page helpful?
0 / 5 - 0 ratings