我不知道这是怎么发生的,但是在我的一个表单中,在一个Bootstrap模式中,Validator错误消息出现时带有如下警告:
我只是没有找到它为什么会这样,而且我找不到重现它的方法,即使是复制/粘贴代码也是如此。
HTML代码为:
<form action="" name="FormAddress" id="FormAddress" method="post" data-toggle="validator">
<input id="do" name="do" value="address_add" type="hidden">
<input id="InputAddressId" name="InputAddressId" value="" type="hidden">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon warning">Address name</span>
<input value="" id="InputName" name="InputName" placeholder="Home, Billing, Holidays..." class="form-control" data-minlength="2" data-error="Not long enough" required="" type="text">
</div>
</div>
<hr style="border-top: 2px solid #8c8b8b;">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Line 1</span>
<input value="" id="InputLine1" name="InputLine1" class="form-control" data-minlength="2" data-error="Not long enough" required="" type="text">
</div>
</div>
<div class="form-group pad-t-10">
<div class="input-group">
<span class="input-group-addon">Line 2</span>
<input value="" id="InputLine2" name="InputLine2" class="form-control" data-minlength="2" data-error="Not long enough" type="text">
</div>
</div>
...
<div class="form-group mar-t-0 mar-b-20">
<button type="submit" id="BtAddress" class="btn btn-primary" style="margin:0px;" data-loading-text="<i class='fa fa-spinner fa-spin fa-lg fa-spin-fix'></i> Send in progress">Send</button>
</div>
</form>
提交表单上的一些jQuery:
$(document).on("submit", "#FormAddress", function(e){
loadingButton($("#BtAddress"));
var values = {"InputName": $("#InputName").val(), "InputLine1": $("#InputLine1").val(),
"InputLine2": $("#InputLine2").val(), "InputCity": $("#InputCity").val(),
etc...
$.ajax({
url: "account/details/ajax/ajax_address.php",
type: "POST",
data: values,
success: function(data) {
$("#AjaxAddress div").remove();
$("#AjaxAddress").html("").html(data);
},
error: function(exception) { console.log(exception); }
});
e.preventDefault();
});
验证器插件:
<script defer src="include/plugins/js/validator.min.js"></script>
这是:https://github.com/1000hz/bootstrap-validator或官方网站:http://1000hz.github.io/bootstrap-validator/
就像我尝试了所有重现此警报错误行为的事情,但这没有成功。
有谁知道如何获得此类警报?