From: Alexander Ebert Date: Thu, 27 Feb 2014 13:30:29 +0000 (+0100) Subject: Properly selecting tabs containing an error X-Git-Tag: 2.0.3~10^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e011af9ea3b9ff389b16d88813b9aece4bb51da1;p=GitHub%2FWoltLab%2FWCF.git Properly selecting tabs containing an error --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 8bcf58f4a7..b9b3021afd 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -3797,19 +3797,47 @@ WCF.TabMenu = { * @return boolean */ _selectErroneousTab: function() { + var $foundErrors = false; for (var $containerID in this._containers) { var $tabMenu = this._containers[$containerID]; - if (!$tabMenu.data('isParent') && $tabMenu.find('.formError').length) { - while (true) { - if ($tabMenu.data('parent') === false) { - break; + if ($tabMenu.find('.formError').length) { + $foundErrors = true; + + if (!$tabMenu.data('isParent')) { + while (true) { + if ($tabMenu.data('parent') === false) { + break; + } + + $tabMenu = $tabMenu.data('parent').wcfTabs('selectTab', $tabMenu.wcfIdentify()); } - $tabMenu = $tabMenu.data('parent').wcfTabs('selectTab', $tabMenu.wcfIdentify()); + return true; } + } + } + + // found an error in a non-nested tab menu + if ($foundErrors) { + for (var $containerID in this._containers) { + var $tabMenu = this._containers[$containerID]; + var $formError = $tabMenu.find('.formError:eq(0)'); - return true; + if ($formError.length) { + // find the tab container + $tabMenu.wcfTabs('selectTab', $formError.parents('.tabMenuContent').wcfIdentify()); + + while (true) { + if ($tabMenu.data('parent') === false) { + break; + } + + $tabMenu = $tabMenu.data('parent').wcfTabs('selectTab', $tabMenu.wcfIdentify()); + } + + return true; + } } }