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
All my validation rules are defined at the field level (useField).
I'm currently working on a component composed by two fields (two input date fields) and I need a validation rule that includes the two fields (to check that the end date is after the start date).
Below is the yup rule, I use in the useField of my second component
yup.date().min(yup.ref('startDate'), ({ min }) => The value must be > ${min})
${min} value is undefined.
I made a test using a form level validation (useForm) with
validationSchema: yup.object({
startDate: yup.date().required(),
endDate: yup.date().min(yup.ref('startDate'), ({ min }) => The value must be > ${min})
}),
and it works perfectly.
My conclusion is that yup.ref is not working with validation rules defined at field level.
Am I right or did I made a mistake ?
Thanks for your help and for the work you've made with that validation framework.
Except that issue, I've succeeded to do everything I need. Thanks.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm working on a Vue.js component library and I use vee-validate for the client-side validation part.
My library is based on the Composition API Custom inputs documentation page (https://vee-validate.logaretm.com/v4/guide/composition-api/custom-inputs/) with yup as a validation library.
All my validation rules are defined at the field level (useField).
I'm currently working on a component composed by two fields (two input date fields) and I need a validation rule that includes the two fields (to check that the end date is after the start date).
Below is the yup rule, I use in the useField of my second component
yup.date().min(yup.ref('startDate'), ({ min }) =>
The value must be > ${min}
)${min} value is undefined.
I made a test using a form level validation (useForm) with
validationSchema: yup.object({
startDate: yup.date().required(),
endDate: yup.date().min(yup.ref('startDate'), ({ min }) =>
The value must be > ${min}
)}),
and it works perfectly.
My conclusion is that yup.ref is not working with validation rules defined at field level.
Am I right or did I made a mistake ?
Thanks for your help and for the work you've made with that validation framework.
Except that issue, I've succeeded to do everything I need. Thanks.
Vincent
Beta Was this translation helpful? Give feedback.
All reactions