I have created a custom form in magento 2. I have placed a checkbox group having different company names as checkbox values like cmpy1, cmpy2, cmpy3 etc. I have also added an input field inside that group for which If somebody didn't belong to the specified company than he/she can enter their own company name. Now I want to give a required validation to this group and I want to use magento 2's default validation if possible.
1 Answer
add the required
class in the checkbox input like
<input class="required" type="checkbox" name="product[category_ids][]" value='<?php echo $cat_model['entity_id'] ?>' />