0

View for the form part looks like

<md-dialog aria-label="Add Attendee">
  <form ng-cloak class="form-horizontal" name="attendeeForm" ng-submit="save(ctrl.attendee) && attendeeForm.$valid" novalidate>
    <md-toolbar>
      <div class="md-toolbar-tools">
        <h2>Enter Attendee</h2>
        <span flex></span>
        <md-button class="md-icon-button" ng-click="cancel()">
          <md-icon md-svg-src="img/icons/ic_close_24px.svg" aria-label="Close dialog"></md-icon>
        </md-button>
      </div>
    </md-toolbar>

    <md-dialog-content>
      <div class="md-dialog-content">
        <div class="form-group">
          <label for="firstName" class="control-label col-md-3 col-sm-4">First Name:</label>
          <div class="col-sm-8"><input type="text" class="form-control" id="firstName" placeholder="First Name" name="firstName" ng-model="ctrl.attendee.firstName" ng-required="true" /></div>
        </div>
        <div class="form-group">
          <label for="lastName" class="control-label col-md-3 col-sm-4">Last Name:</label>
          <div class="col-sm-8"><input type="text" class="form-control" id="lastName" placeholder="Last Name" name="lastName" ng-model="ctrl.attendee.lastName" ng-required="true" /></div>
        </div>
        <div class="form-group">
          <label for="email" class="control-label col-md-3 col-sm-4">Email:</label>
          <div class="col-sm-8"><input type="email" class="form-control" id="email" placeholder="Email Address" name="email" ng-model="ctrl.attendee.email" ng-required="true" /></div>
        </div>
      </div>
    </md-dialog-content>

    <md-dialog-actions layout="row">
      <span flex></span>
      <button class="btn btn-primary" type="submit">Save Attendee</button>
    </md-dialog-actions>
  </form>
</md-dialog>

When I submit that form without required fields the form is passing validation and can be submited. When I will remove novalidate it works fine which has no sense based on an answer from Angularjs prevent form submission when input validation fails which states No need for controller checks.

Any clue what is going on with it?

JackTheKnife
  • 3,795
  • 8
  • 57
  • 117

0 Answers0