Search code examples
javascriptjquerybootstrapvalidator

bootstrapValidator skip certain field


<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
}

I have a login form use bootstrapValidator, There is a field for captcha

I have set maxlength 4 & required for this field. I need validator skip and dont validate this field. (because when user enter wrong captcha code but it still show tick because length is correct)


Solution

  • By setting required on the input, you are telling the validator that it needs to validate the field.

    If you don't want the validator to process this field, remove both required and maxlength and then handle the value checking yourself using an onchange or onsubmit handler, or another way.