2014-09-04 98 views
0

我想知道BootstrapValidator http://bootstrapvalidator.com/是否有typeahead验证。BootstrapValidator for bootstrap typeahead

我有一个窗体,我在哪里验证我的领域使用验证。其中一个字段是一个inout字段,其中附加了typeahead,所以输入字段由typeahead选择填充。

但是,无论何时我开始在输入字段中键入验证器验证其真实。我想像它一样,必须在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' 
         } 
        } 
       }, 
      } 
     }) 

我的预输入看起来像

$(ele).typeahead({ 
    select:function(){ 
     // here i do the select..... 
    } 
}); 

回答

0

我使用日期选择器遇到了类似的问题 - 你可以尝试手动绑定验证 - 如:

$('#userCountry').on('blur', function(e) { 
    $('#user_reg_form').bootstrapValidator('revalidateField', 'userCountry'); 
}); 

请问您的预输入控制限制他们到列表中的选项之一?