Skip to content

Remove Duet input fields (CFM-277) #97

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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