I want to create a form that contain a checkbox field. Initially, the checkbox is unchecked and a field under it is disabled. If all other required fields are fill correctly, the submit button will be enable for submitting the form. Once the user checked the checkbox, the field under it will be enabled (this is a required field if enabled) thus, submit button needs to be disabled again. If unchecked again, submit button will enabled again. How can I achieve this behavior?
Asked
Active
Viewed 758 times
0
-
https://stackoverflow.com/questions/65715811/yup-useformik-conditional-required-field-based-on-some-parameter/65715969 check if this helps – Nik Feb 02 '22 at 10:48
-
Thanks but it's not relevant – Shira Feb 02 '22 at 11:08
-
Ok. can you please add a sample code snippet describing the issue? – Nik Feb 02 '22 at 11:11