mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 21:16:28 +02:00
Remove double errors on form
This commit is contained in:
parent
7d2f4f7f4e
commit
a05afb0958
1 changed files with 2 additions and 11 deletions
|
@ -220,12 +220,14 @@ function validateFormsetInputs(e, availabilityButton) {
|
||||||
// Run validators for each input
|
// Run validators for each input
|
||||||
inputs.forEach(input => {
|
inputs.forEach(input => {
|
||||||
runValidators(input);
|
runValidators(input);
|
||||||
|
removeFormErrors(input, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the validate-for attribute on the button with the collected input IDs
|
// Set the validate-for attribute on the button with the collected input IDs
|
||||||
// Not needed for functionality but nice for accessibility
|
// Not needed for functionality but nice for accessibility
|
||||||
inputs = inputs.map(input => input.id).join(', ');
|
inputs = inputs.map(input => input.id).join(', ');
|
||||||
availabilityButton.setAttribute('validate-for', inputs);
|
availabilityButton.setAttribute('validate-for', inputs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// <<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>
|
// <<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>>
|
||||||
|
@ -260,17 +262,6 @@ function validateFormsetInputs(e, availabilityButton) {
|
||||||
button.addEventListener('click', validateFieldInput);
|
button.addEventListener('click', validateFieldInput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear errors on auto-validated inputs when user reselects input
|
|
||||||
const autoValidateInputs = document.querySelectorAll('[auto-validate]');
|
|
||||||
if (autoValidateInputs) {
|
|
||||||
for (const input of autoValidateInputs){
|
|
||||||
input.addEventListener('input', function() {
|
|
||||||
removeFormErrors(input, true);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue