So I have this start date field and it will correctly show an error if the start date is after the end date of an event. However, I want to make it so that the form itself won't submit. I do not know how to prevent form submission with custom validation.
<fieldset ng-controller="ConfigCtrl" show errors>
<label>Event Start Date</label><sup class="req-field">*</sup>
<div class=" input-group" ng-class="{'has-error': event.info.date >= event.info.end_date}">
<input type="text" name="start-date" class="form-control" datetime-picker="dd MMM yyyy HH:mm" datepicker-append-to-body="true" ng-model="event.info.date" max-val="{{event.info.end_date}}" is-open="isOpen[0]" date-validator ng-focus="openCalendar(0)" required>
<span class=" input-group-btn">
<button class="btn btn-default" type="button" ng-click="openCalendar(0)">
<i class="fa fa-calendar"></i>
</button>
</span>
</div>
</fieldset>
This is the code for the submit button:
<button class="btn btn-primary" ng-click="saveEvent(event, 'editBasicInfo');editBasicInfo = !editBasicInfo" ng-disabled="basicInfoForm.$invalid">Submit</button>
If I have a field validate for something like ng-maxlength, the submit button will be disabled. How do I do the same for this custom validation?