Skip to content

Commit

Permalink
[1000hz/bootstrap-validator] don't clear error if another input has e…
Browse files Browse the repository at this point in the history
  • Loading branch information
k-oshima committed Apr 13, 2016
1 parent e56a4e8 commit e8e40b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,18 @@
var $block = $group.find('.help-block.with-errors')
var $feedback = $group.find('.form-control-feedback')

// check that no other input in same group has error
var $otherHaserror = false
$group.find(':input').each(function($i, $other) {
var $errors = $($other).data('bs.validator.errors')
if ($errors && $errors.length) {
$otherHaserror = true
return false
}
})
if ($otherHaserror)
return;

$block.html($block.data('bs.validator.originalContent'))
$group.removeClass('has-error has-danger')

Expand Down

0 comments on commit e8e40b7

Please sign in to comment.