From e011af9ea3b9ff389b16d88813b9aece4bb51da1 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 27 Feb 2014 14:30:29 +0100 Subject: [PATCH] Properly selecting tabs containing an error --- wcfsetup/install/files/js/WCF.js | 40 +++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 6 deletions(-) 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; + } } } -- 2.20.1