From d40e470dcc2ac7889b32e3159ee4e170ca7175bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Queiruga?= Date: Sun, 24 Jan 2021 10:06:22 +0100 Subject: [PATCH] [JENKINS-64429] Fix registerValidator breaking error messages (#5195) --- war/src/main/webapp/scripts/hudson-behavior.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/war/src/main/webapp/scripts/hudson-behavior.js b/war/src/main/webapp/scripts/hudson-behavior.js index 63afe135be..3fd9410aa5 100644 --- a/war/src/main/webapp/scripts/hudson-behavior.js +++ b/war/src/main/webapp/scripts/hudson-behavior.js @@ -500,13 +500,16 @@ var tooltip; //======================================================== // using tag names in CSS selector makes the processing faster function registerValidator(e) { - var settingMain = e.closest('.setting-main') - if (!settingMain) { + + // Retrieve the validation error area + var tr = findFollowingTR(e, "validation-error-area"); + if (!tr) { console.warn("Couldn't find the expected parent element (.setting-main) for element", e) return; } // find the validation-error-area - e.targetElement = settingMain.nextElementSibling; + e.targetElement = tr.firstChild.nextSibling; + e.targetUrl = function() { var url = this.getAttribute("checkUrl"); var depends = this.getAttribute("checkDependsOn");