Make a toggle required based on the other 3 fields
Hey
I wanted to change the toggle required/not required based on the change of select value. From the select value, I'm having 3 values on which the selection toggle is required and the rest of the values toggle is not required.
This will be the initial case. I've to update the toggle based on 3 other fields.
My code is attached. How can I do it?
11 Replies
Tried this. required() works but form is submitting without toggle check
could be better, but didn't it work?
Yes, this also works. The field is required() properly. But when I submit the form without checking that toggle, it's not displaying me an error message.
Validation failed for the required() is not working.
toogle is false/true... false/true is a value. Do you need to check if it is true/checked?
true
?
Yes, I wanted to check it is true or not.
change required to accepted
If false then give a validation message
And if true pass the form and submit
try accepted instead of required
Thank you π