lundi 14 mars 2016

Angula.JS: checkbox array validation

I have a set of checkboxes in a form. How can I validate the form when at least one of them is checked?

<div class="col-lg-9 col-md-9 col-sm-9 col-xs-9" ng-init="row.user_input = {}">
    <div ng-repeat="value in row.allowed_values" class="checkbox-inline">
        <input type="checkbox"
               name="{{row.field}}"
               value="{{value}}"
               ng-model="row.user_input[value]"
               ng-required="{{row.mandatory_field && !someSelected(row.user_input)}}">{{value | capitalize}}
    </div>
</div>

Here a whole bunch of details.




Aucun commentaire:

Enregistrer un commentaire