You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would you set an error message for a structure like:
formModelSchema = yup.object({
name: yup.object({
first: yup.string().min(2).required('First name is required'),
middle: yup.string(),
last: yup.string().min(2).required('Last name is required')
}).required('Full name is required'),
email: yup.string().email().required('E-mail input is required')
});
@supermoos I'm not sure your code is written to meet your goal. As you wrote it, only an object instance is required. name: null would have to occur before you received Full name is required.
If you want Full name is required when either first or last name is missing, just add that to those fields.
formModelSchema=yup.object({name: yup.object({first: yup.string().min(2).required('Full name is required'),middle: yup.string(),last: yup.string().min(2).required('Full name is required')}),email: yup.string().email().required('E-mail input is required')});
How would you set an error message for a structure like:
So that if for example first,name was input correctly but last.name was missing the error message would be: 'Full name is required'
The text was updated successfully, but these errors were encountered: