我想知道BootstrapValidator http://bootstrapvalidator.com/是否有typeahead的验证。
我有一个表单,其中我使用验证器验证我的字段。
但是,每当我开始在输入字段中键入内容时,验证器就会验证它的true。我想要的东西,它必须验证后,只有在typeahead选择,而不是通过在输入字段中写入。
$(document).ready(function() {
var options = {};
options.common = {
minChar: 1
};
options.ui = {
showVerdictsInsideProgressBar : true,
viewports : {
progress : ".pwstrength_viewport_progress"
}
};
.......
$('#user_country').on('input', function() {
$(this).parent().find('.small').hide();
});
$('#user_reg_form').bootstrapValidator({
excluded: ':disabled',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
........
country: {
validators: {
notEmpty: {
message: 'city is required'
}
}
},
}
})我的typeahead看起来像这样
$(ele).typeahead({
select:function(){
// here i do the select.....
}
});发布于 2014-09-17 21:59:55
我在使用日期选择器时遇到了类似的问题-你可以尝试手动绑定验证-例如:
$('#userCountry').on('blur', function(e) {
$('#user_reg_form').bootstrapValidator('revalidateField', 'userCountry');
});您的typeahead控件是否将它们限制为列表中的一个选项?
https://stackoverflow.com/questions/25667016
复制相似问题