Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add address validation flow #46

Merged
merged 5 commits into from
Feb 15, 2024
Merged

Add address validation flow #46

merged 5 commits into from
Feb 15, 2024

Conversation

spokenbird
Copy link
Collaborator

This PR utilizes JavaScript on the mailing address screen within the thymeleaf template to grab input values from the home address screen if the user selects that their mailing address is the same as their home address. It then inserts those values in the mailing address inputs so that Smarty has the address fields to validate within the form data at the time the POST occurs.

- Breaks when home and mailing address are different due to index error on sameAsHomeAddress input check
@spokenbird spokenbird requested a review from bseeger February 13, 2024 21:32
Copy link
Contributor

@bseeger bseeger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good overall, but there is one spot I called out that might need a change.

import org.springframework.stereotype.Component;

/**
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please fill this in?

import org.springframework.stereotype.Component;

/**
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please fill this in?

<label th:for="${inputName} + '-' + ${value}"
th:id="${inputName} + '-' + ${value} + '-label'"
class="checkbox display-flex">
<!-- <input type="hidden" th:id="${inputName} + 'Hidden'" th:name="${name}" value="">-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need this anymore?

document.getElementById("mailingAddressZipCode").value = inputData['homeAddressZipCode'] || '';
} else {
if (!onPageLoad) {
// Clear mailing address fields if checkbox is unchecked
Copy link
Contributor

@bseeger bseeger Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to consider "onPageLoad" for the checkbox as well.

I am seeing my corrected mailing address (was same as home address, so the checkbox is clicked) getting overwritten again by the home address, when I go back to the page.

Scenario: I enter a home address and submit it; then on the mailing page I click that my mailing address is the same as my home address. On the next page I choose the corrected version and click continue. Then I go back to the mailing address page and see the old (uncorrected) home address.

The only time the home address should override the mailing is if I actively click on the box on that page - not if it's set when the page loads.

@spokenbird spokenbird merged commit 7c8ff8a into main Feb 15, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants