I have to validate the 'description' field when 'gender' field value is others or female but when it is male no validation required for the 'description' field.
First I want to show this code and this is valid and working:
description: Yup.string().when(['gender'], {
is: (gender) => gender=== 'others',
then: Yup.string().required('Description is Required')
})
But Now I have to use multiple conditions like this:
description: Yup.string().when(['gender'], {
is: (gender) => gender=== 'others' || 'female' ,
then: Yup.string().required('Description is Required')
})
But It's not working. Please Give me a solution. Thanks in advance...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…