I have a group of checkboxes and a group if radios and I want to validate with react hook form to ensure that an error message is generated if none have been selected on submit.
I have tried experimenting with the form builder on their website but I cant work out how to validate a group of items as a single unit of validation.
<div>
<span>Option A <input type="checkbox" value="A" /></span>
<span>Option B <input type="checkbox" value="B" /></span>
<span>Option C <input type="checkbox" value="C" /></span>
</div>
<...output a validation error if one or more checkboxes hasnt been checked within the group>
<div>
<span>Option A <input type="radio" value="A" /></span>
<span>Option B <input type="radio" value="B" /></span>
<span>Option C <input type="radio" value="C" /></span>
</div>
<...output a validation error if one or more radios hasnt been checked within the group>
Is this possible and is there a correct way to do it?
Thank you for your time and attention.