fields that are required but disabled are not filtered in isIncomplete()
Disabled input fields are checked for validation...
I have a form with a collapsed area. When i toggle the collapse, I set the disabled property of the inputs in that area to false so they are not validated. But the inputs are also required when they are shown.
https://github.com/1000hz/bootstrap-validator/blob/master/js/validator.js#L303
it should be "[required]:not([disabled])":
Validator.prototype.isIncomplete = function () {
function fieldIncomplete() {
var value = getValue($(this))
return !(typeof value == "string" ? $.trim(value) : value)
}
return !!this.$inputs.filter('[required]:not([disabled])').filter(fieldIncomplete).length
}
Another solution would be to add the condition to update() where it sets this.$inputs
related link: https://api.jquery.com/enabled-selector/ :enabled isn't used because it needs to check the attribute in my opinion.
possibly related to #328, #333
I would set .attr('data-validate', false) and call .validator('update') instead of setting disabled.
Yup, thats what i did too. Still, it would make sense to ignore disabled inputs, even if it is the default browser behavior.