【问题标题】:BootstrapValidator for bootstrap typeaheadBootstrapValidator 用于引导预输入
【发布时间】:2014-09-04 13:39:18
【问题描述】:

我想知道 BootstrapValidator http://bootstrapvalidator.com/ 是否有预输入验证。

我有一个表单,我在其中使用验证器验证我的字段。其中一个字段是 inout 字段,其中附加了预输入,因此输入字段由预输入选择填充。

但是每当我开始在输入字段中输入时,验证器都会验证它的真实性。我希望它必须仅在预先选择后验证,而不是通过在输入字段中写入来验证。

$(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.....
   }
 });

【问题讨论】:

    标签: twitter-bootstrap-3 validation typeahead.js typeahead


    【解决方案1】:

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

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

    您的预先输入控件是否将它们限制为列表中的选项之一?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      • 2014-01-13
      • 1970-01-01
      • 2019-12-16
      • 1970-01-01
      相关资源
      最近更新 更多