-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
- Breaks when home and mailing address are different due to index error on sameAsHomeAddress input check
There was a problem hiding this 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; | ||
|
||
/** | ||
* |
There was a problem hiding this comment.
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; | ||
|
||
/** | ||
* |
There was a problem hiding this comment.
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="">--> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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.