I have been working on validating a form using a combination of bootstrap and angularjs. The form includes two groups of checkboxes that need to be validated. It is required for the user to select at least one checkbox from each group in order for the Submit button to be enabled and for the values to be submitted.
Here is a demo showcasing this functionality: https://plnkr.co/edit/m5erCJINS1sj70FxInd4?p=preview
In the provided demo, the user must choose at least one option from the RED or BLUE group and one option from the Mac1 or Mac2 group in order to enable the SubmitValue button and submit the data.
Sample code snippet:
<form name="eltForm">
<h4>--FORM VALIDATION--</h4>
<div class="btn-group" name="color">
<label class="btn btn-primary btn-sm" ng-model="model1.prod1" uib-btn-checkbox="prod1">RED
<span class="glyphicon glyphicon-info-sign"></span>
</label>
<label class="btn btn-primary btn-sm" ng-model="model1.prod2" uib-btn-checkbox="prod2">BLUE
<span class="glyphicon glyphicon-info-sign"></span>
</label>
<div ng-show="eltForm.$submitted || eltForm.color.$touched">
<p class="error-mesg" ng-show="eltForm.color.$error.required">Please Select the Color.</p>
</div>
</div>
<div class="btn-group" style="margin: 0 3px;padding: 5px;" name="machines">
<label class="btn btn-primary btn-sm" ng-model="model2.item1" uib-btn-checkbox="item1">Mac1
<span class="glyphicon glyphicon-info-sign"></span>
</label>
<label class="btn btn-primary btn-sm" ng-model="model2.item2" uib-btn-checkbox="item2">Mac2
<span class="glyphicon glyphicon-info-sign"></span>
</label>
<div ng-show="eltForm.$submitted || eltForm.machines.$touched">
<p class="error-mesg" ng-show="eltForm.machines.$error.required">Please Select the Machines.</p>
</div>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary btn-xs" style="margin: 13px;" ng-click="submitValue()" ng-disabled="myForm.$invalid">SubmitValue</button>
</div>
</form>