From 6aebbada064689ef8dcc853e957aa41a928d2036 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Mon, 19 Feb 2024 10:39:18 +0100 Subject: [PATCH] Form Input: only setFeedback on last radio/checkbox in production mode --- public/js/components/Form/Input.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/public/js/components/Form/Input.js b/public/js/components/Form/Input.js index 4103c75cf..97a261779 100644 --- a/public/js/components/Form/Input.js +++ b/public/js/components/Form/Input.js @@ -200,13 +200,9 @@ export default { this.valid = valid; // NOTE(chris): On a list of radios/checkboxes only add the feedback message to the last item if (this.name && (this.lcType == 'radio' || this.lcType == 'checkbox')) { - let n = this.$el.nextSibling; - for (; n; n = n.nextSibling) - if (n.nodeType == 1 - && n.__vueParentComponent?.ctx?.lcType == this.lcType - && n.__vueParentComponent?.ctx?.name == this.name - ) - return; + const selector = 'input[type="' + this.lcType + '"][name="' + this.name + '"]'; + if ([...this.$el.parentNode.querySelectorAll(selector)].pop() != this.$refs.input) + return; } this.feedback = feedback; },