Closed khalilbenachir closed 9 months ago
Not sure exactly how to do this, but the Schema.test
function added to one of them should allow you to check if all of them add up to 100. There is a context passed to it that you can use to get the other values then do the test.
Yup.object().shape({
input1: Yup.number().required(),
input2: Yup.number().required(),
input3: Yup.number().required(),
input4: Yup.number().required(),
}).test((value) => /*do the check here */)
I apologize for using this platform to pose my question, but after searching in various places, I couldn't find a solution. I have a schema as follows:
I want to ensure that the sum of the fourth inputs is 100. Has anyone encountered and resolved this issue before?