【问题标题】:bootstrapValidator skip certain fieldbootstrapValidator 跳过某些字段
【发布时间】:2017-03-20 03:23:12
【问题描述】:
<input id="captcha_code" type="text" class="form-control captcha" name="captcha" maxlength="4" required>

password: {
    validators: {
        notEmpty: {
        },
        stringLength: {
            min: 6,
            max: 24,
        }
    }
},
captcha: {
    validators: false
}

我有一个使用 bootstrapValidator 的登录表单,有一个用于验证码的字段

我已为此字段设置了 maxlength 4 & required。我需要验证器跳过并且不验证此字段。 (因为当用户输入了错误的验证码但它仍然显示勾号,因为长度是正确的)

【问题讨论】:

    标签: javascript jquery bootstrapvalidator


    【解决方案1】:

    通过在input 上设置required,您是在告诉验证器它需要验证该字段。

    如果您不希望验证器处理此字段,请同时删除 requiredmaxlength,然后使用 onchangeonsubmit 处理程序或其他方式自行处理值检查。

    【讨论】:

      【解决方案2】:

      使用它来禁用 验证码:{ 启用:假 }

      【讨论】:

        猜你喜欢
        • 2016-12-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-07-20
        • 1970-01-01
        • 2012-07-08
        相关资源
        最近更新 更多