Working with Angular 1.5.11
I have a html form with several fileds like :
<div ng-app="validationApp" ng-controller="mainController">
<div class="container">
<div class="row">
<form name="weightForm" ng-submit="submitForm()" novalidate>
<input class="input" data-required="" fn-restrict-integer="" maxlength="4" name="weight1" id="weight1" ng-model="weight1" fn-min-value="1" fn-max-value="9999" />
<input class="input" data-required="" fn-restrict-integer="" maxlength="4" name="weight2" id="weight2" ng-model="weight2" fn-min-value="1" fn-max-value="9999" />
<input class="input" data-required="" fn-restrict-integer="" maxlength="4" name="weight3" id="weight3" ng-model="weight3" fn-min-value="1" fn-max-value="9999" />
<div>
<dl aria-invalid="{{totalWeightIsAboveLimit()}}">
<p class="input__error">total weight above limit</p>
</dl>
</div>
<button type="submit" class="btn btn-primary" ng-disabled="weightForm.$invalid">Submit</button>
</form>
</div>
</div>
</div>
How can I build a validation that considers the values of the three fields as a group, in this case the sum of the fields entered.
I have built a validation function function to toggle the message, but I don't know how to make the form invalid, based on the outcome of this function.
But I don't know how to make the whole form inavalid to prevent the submit.