1

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.

0

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'] ?>' />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.