Skip to content

Commit

Permalink
Fix issue with missing datepicker form label by stripping out unused …
Browse files Browse the repository at this point in the history
…datepicker input fields (CFM-277) (#97)
  • Loading branch information
arlen authored Jun 14, 2023
1 parent 8841d43 commit d8a60ea
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions app/templates/element/javascript.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
});

Expand Down

0 comments on commit d8a60ea

Please sign in to comment.