我正在尝试使用http://bootstrapvalidator.com/验证表单,常规控件工作正常,但对于来自https://github.com/danielfarrell/bootstrap-combobox的组合框控件,我无法显示验证消息。
HTML:
<form id="frmVisaForm" name="frmVisaForm" class="horizontal" method="post">
<div class="col-sm-12 form-group"> <span class="help-block span-required">Place of Issue</span>
<select id="cmbApplicantPassportPlace" name="cmbApplicantPassportPlace" class="form-control combobox" required>
<option value="">Select</option>
<option value="Delhi">Delhi</option>
<option value="Delhi">Jaipur</option>
</select>
</div>
<div class="col-sm-12 form-group"> <span class="help-block span-required">Country of Issue</span>
<select id="cmbApplicantPassportCountry" name="cmbApplicantPassportCountry" class="form-control" required>
<option value="">Select</option>
<option value="Delhi">India</option>
<option value="Delhi">Nepal</option>
</select>
</div>
<div>
<button class="btn btn-primary">Submit</button>
</div>
</form>
JS:
$(document).ready(function () {
$('.combobox').combobox();
$('#frmVisaForm').bootstrapValidator({
submitHandler: function (validator, form, submitButton) {
return false;
}
});
});
http://jsfiddle.net/sudiptabanerjee/b5MG9/
请帮助。
最诚挚的问候 Sudipta Banerjee
答案 0 :(得分:1)
要强制用户从选择框中选择一个选项,请提供一个空选项
<强>值=&#34;&#34; 强>&GT;选择...
<select class="form-control col-md-3" name="guests">
<option value="">--No of Guests--</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>