Merge "Check if the alert box has a sibling element, delete its parent if it doesn't exist"

This commit is contained in:
Zuul 2018-12-26 19:09:22 +00:00 committed by Gerrit Code Review
commit 3ffd1feca9
1 changed files with 5 additions and 1 deletions

View File

@ -109,7 +109,11 @@ horizon.modals.init_wizard = function () {
}
// Clear old errors.
$form.find('div.row div.alert-danger').parent().remove();
if ($form.find('div.row div.alert-danger').siblings().length == 0) {
$form.find('div.row div.alert-danger').parent().remove();
} else {
$form.find('div.row div.alert-danger').remove();
}
$form.find('.form-group.has-error').each(function () {
var $group = $(this);
$group.removeClass('has-error');