Greetings! I am facing a minor issue that needs to be addressed. The scenario is as follows: I need to implement validation based on the type of member. If the member type is corporate, then the tax number should be mandatory while the phone number can be left empty. Conversely, if the member type is individual, the opposite rules should apply.
For clarification: When the value is false, only phone validations are required. However, when the value is true, only tax validations are necessary.
setup() {
const value = ref(false);
const validationSchema = Yup.object().shape({
phone: Yup.string().trim().required().label("Phone"),
tax: Yup.string().trim().required().label("Tax"),
});
const { handleSubmit } = useForm({ validationSchema });
const submit = handleSubmit(async (values) => {
console.log("personName:", values);
});
return {
validationSchema,
submit,
value,
};
},