From d8a60ea87c143b7cd68827c13c13bf9545aabde3 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Wed, 14 Jun 2023 11:05:11 -0400 Subject: [PATCH] Fix issue with missing datepicker form label by stripping out unused datepicker input fields (CFM-277) (#97) --- app/templates/element/javascript.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/templates/element/javascript.php b/app/templates/element/javascript.php index e65693ed6..8007646b4 100644 --- a/app/templates/element/javascript.php +++ b/app/templates/element/javascript.php @@ -88,6 +88,16 @@ $(this).removeClass('hasValue'); } }); + + // DUET DATEPICKER + // We use the accessible Duet Datepicker only for its picker - never for its + // input fields. Strip out the Duet input fields if they exist so the forms never + // attempt to submit them. This will also fix any issues with missing labels. + let dateWidgetInputs = document.querySelectorAll('duet-date-picker input'); + // Remove all the Vue related fields + Array.prototype.slice.call(dateWidgetInputs).forEach( (el) => { + el.parentNode.removeChild(el); + }); // TOP FILTER FORM // Send only non-empty fields in the form @@ -128,13 +138,6 @@ $(filterId).val(""); }); - // Remove the Vue date fields if exist - let dateWidgetInputs = document.querySelectorAll('duet-date-picker input'); - // Remove all the Vue related fields - Array.prototype.slice.call(dateWidgetInputs).forEach( (el) => { - el.parentNode.removeChild(el); - }); - $(this).closest('form').submit(); });