@@ -24,7 +24,8 @@
// End date field should be shown only when "a specific past date" is selected.
const form = document.querySelector('#assignment-form');
const past_date_label = document.querySelector('label[for=id_period_ends]');
const past_date_field = document.querySelector('#assignment-form > p:nth-child(11)');
const past_date_field = document.querySelector('#id_period_ends');
const past_date_container = past_date_field.parentElement;
form.addEventListener('change', togglePastDate);
togglePastDate(); // Run change handler once to initialise form.
@@ -33,10 +34,12 @@
function togglePastDate() {
if (form['period_end_type'].value === 'all future contributions') {
past_date_field.style.display = 'none';
past_date_container.style.display = 'none';
past_date_field.required = false;
}
else {
past_date_field.style.display = '';
past_date_container.style.display = '';
past_date_field.required = true;
</script>