I'm trying to make a field "old_password" required only if another filed "password" is filled with some value.
It works when using the .when()
function in Yup, but when the other field "password" gets empty, the "old_password" still gives me the error message that it is required, even though the "password" is empty.
Also when I implement this, the "name" field validation is not working anymore for some reason.
I don't know how to solve this.
Here's a sample code ...