0
votes

I am using Material UI's Autocomplete multiple TextField, React Hook Form, and Yup to validate the form inputs.

The following form asks a user to input days of the week. If they input "every day", the other options are disabled/if a user inputs any day(s), the "every day" option is disabled.

On my form, I have set it so that if the form input is not valid, the submit button will remain disabled. I am trying to use the following Yup validation schema to do this, but it is not working...

const validationSchema = Yup.object().shape({
daysOfWeek: Yup.array()
    .of(
        Yup.object().shape({
            label: Yup.string(),
            disabled: Yup.boolean(),
        })
    )
    .min(1, "Days of the week are required")
});

Can you please check out my code sandbox and see what may be going wrong? Thanks so much in advance!

https://codesandbox.io/s/mystifying-cookies-n5iyl