Skip to content

Commit

Permalink
Make address fields required.
Browse files Browse the repository at this point in the history
  • Loading branch information
bseeger committed Jun 14, 2024
1 parent c137b40 commit f0035b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/main/resources/templates/mdBenefitsFlow/homeAddress.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<th:block th:replace="~{fragments/inputs/address ::
address(
validate=false,
inputName='homeAddress'
inputName='homeAddress',
requireAddressFields=true
)}"/>
</span>
</div>
Expand Down
14 changes: 9 additions & 5 deletions src/main/resources/templates/mdBenefitsFlow/mailingAddress.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<th:block th:replace="~{fragments/inputs/address ::
address(
validate=true,
inputName='mailingAddress'
inputName='mailingAddress',
requireAddressFields=true
)}"/>
</span>
</div>
Expand All @@ -50,11 +51,14 @@
var checkbox = document.getElementById("sameAsHomeAddress-true");
if (checkbox && checkbox.checked) {
// Copy values from home address to mailing address
document.getElementById("mailingAddressStreetAddress1").value = inputData['homeAddressStreetAddress1'] || '';
document.getElementById("mailingAddressStreetAddress2").value = inputData['homeAddressStreetAddress2'] || '';
document.getElementById(
"mailingAddressStreetAddress1").value = inputData['homeAddressStreetAddress1'] || '';
document.getElementById(
"mailingAddressStreetAddress2").value = inputData['homeAddressStreetAddress2'] || '';
document.getElementById("mailingAddressCity").value = inputData['homeAddressCity'] || '';
document.getElementById("mailingAddressState").value = inputData['homeAddressState'] || '';
document.getElementById("mailingAddressZipCode").value = inputData['homeAddressZipCode'] || '';
document.getElementById("mailingAddressZipCode").value = inputData['homeAddressZipCode']
|| '';
} else {
if (!onPageLoad) {
// Clear mailing address fields if checkbox is unchecked
Expand All @@ -71,7 +75,7 @@
document.getElementById("sameAsHomeAddress-true").addEventListener("change", updateAddressFields);

// Call the function on page load to check the initial state of the checkbox
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function () {
updateAddressFields(true);
});
</script>
Expand Down

0 comments on commit f0035b9

Please sign in to comment.