angularjs - Validate autocomplete field required -
i have mandatory autocomplete field in form , need validate, in validation $ invalid works partially, after filling field , delete value not identify invalid , value $ error.required blank.
here code:
<form name="editform" role="form" novalidate ng-submit="vm.save()" show-validation> <div class="form-group"> <label data-translate="coreapp.costcenter.company" >company</label> <angucomplete-alt id="field_company" pause="300" placeholder="{{'coreapp.crud.autocomplete' | translate}}" match-class="text-blue" ng-model="vm.costcenter.company_complete" input-name="company_complete" field-required="true" remote-api-handler="vm.searchcompany" remote-url-response-formatter="vm.searchformatter" remote-url-data-field="data" selected-object="vm.setcompany" title-field="name" minlength="2" input-class="form-control form-control-small" /> </div> <div ng-show="editform.company_complete.$invalid && editform.company_complete.$dirty"> <p class="help-block" ng-show="editform.company_complete.$error.required" data-translate="entity.validation.required"> field required. </p> </div>
Comments
Post a Comment