i have angular form styled bootstrap containing required field. after submitting , resetting form, html5 validation tooltip appears, indicating required field:
i find inconsistent tooltip doesn't appear if field focused in empty state in other way.
how suppress tooltip after reseting form?
here running plunker
form:
<form class="form-horizontal" name="testform"> <div class="form-group"> <label class="col-sm-2 control-label" for="current-input">input:</label> <div class="col-sm-10"> <div class="input-group"> <input name="current-input" class="form-control" ng-model="current_input" required /> <span class="input-group-btn"><button class="btn btn-primary" type="submit" ng-click="check()">check</button></span> </div> </div> </div> </form>
controller:
$scope.check = function() { $scope.testform.$setpristine(); $scope.testform.$setuntouched(); $scope.last_input = $scope.current_input; $scope.current_input = "" }
just add ng-submit , set check function instead of calling check onclick, because specifying button type submit below :
<form class="form-horizontal" name="testform" ng-submit="check()">
......
<span class="input-group-btn"><button class="btn btn-primary" type="submit" >check</button></span>
then work
cheers
Comments
Post a Comment