Skip to content

Commit e8e40b7

Browse files
committed
[1000hz/bootstrap-validator] don't clear error if another input has errors inside a same form group. 1000hz#112
https://github.com/1000hz/bootstrap-validator/pull/112/files
1 parent e56a4e8 commit e8e40b7

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

js/validator.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,18 @@
201201
var $block = $group.find('.help-block.with-errors')
202202
var $feedback = $group.find('.form-control-feedback')
203203

204+
// check that no other input in same group has error
205+
var $otherHaserror = false
206+
$group.find(':input').each(function($i, $other) {
207+
var $errors = $($other).data('bs.validator.errors')
208+
if ($errors && $errors.length) {
209+
$otherHaserror = true
210+
return false
211+
}
212+
})
213+
if ($otherHaserror)
214+
return;
215+
204216
$block.html($block.data('bs.validator.originalContent'))
205217
$group.removeClass('has-error has-danger')
206218

0 commit comments

Comments
 (0)