我在页面上使用了 map ,当我单击“cellSize”按钮时,会出现填充字段警告。我不想这样。如何解决这个问题?
这是我的文本字段:
<div class="form-group">
<label for="name">Name</label>
<input ng-model="Name" ng-readonly="view.readonly" ng-maxlength="100" type="text" class="form-control input-sm" id="cluster-name" placeholder="Name" required>
</div>
这是我点击的增量按钮:
change: function () {
this.trigger("spin");
$scope.cellSizeCoefficient = this.value();
$scope.$broadcast('mapCellSizeChanged', $scope.map);
$.each($scope.cellShapes, function (index, cellShape) {
var radius = getRadius(cellShape.Cell);
cellShape.Circle.setRadius(radius);
if (cellShape.Circle.label) {
var labelLoc = findLocationAtDistanceFrom(cellShape.Cell.LOC, cellShape.Cell.AZ, radius);
cellShape.Circle.label.setLatLng([labelLoc.Y, labelLoc.X]);
}
});
if (selectedCellCircle) {
var radius = getRadius(selectedCellCircle.Cell) + 50;
selectedCellCircle.setRadius(radius);
}
}
最佳答案
您看到这条消息是由于 required
输入元素上的属性。当 form
时显示提交是在单击“增量”按钮时发生的。
要停止该行为,请添加 type="button"
属性为button
:
<button type="button" style="margin-left:2px;" kendo-button="btnCellSizeIncrement" k-options="btnCellSizeIncrementOptions">
<i class="fa fa-plus pi-icon pi-icon-plus"></i>
</button>
仅供引用,您应该添加 type="button"
任何 button
上的属性您不想提交 form
的元素当它们被点击时。
关于javascript - 为什么当我单击不相关按钮时显示 "Please fill out this field"验证消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45876691/