-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feat(eligibility/form): custom validation message for index and confirm fields #2045
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
2058dbd
to
00c9e86
Compare
Side note: our Cypress tests were actually really helpful for this PR. They fail tests that encounter syntax errors, which caught regressions on pages that contain forms but don't need custom validation messages. 🎉 See GitHub Action runs: |
59c4808
to
e0f296e
Compare
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.
Yes that looks good, just one more small change.
Need to resolve conflicts |
f6ebcd1
to
eb2264a
Compare
event listeners on the inputs and form check validity and set a custom message if the input is not valid. the custom message is defined as a data attribute on the input element.
this should've been removed in #1022
the data is such that would pass browser validation
this behavior is not included in product requirements
query for elements with the 'data-custom-validity' attribute instead of trying to use form fields. the eligibility index for example only has 1 field with 4 inputs.
instead of specifying it in the template
eb2264a
to
ccff754
Compare
Rebased on top of #2042 and waiting for it to be merged to minimize merge conflicts |
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.
Eligibility index
Confirming custom error messages:
Eligibility confirm
Confirming custom error messages:
Closes #2012
Reviewing
Eligibility Index form
Eligibility Confirm form
Cases to try with
sub
field (card number field):In all those cases, you should get a browser validation message that says "Please enter a X-digit number." where X is the number specific for the transit benefit (5 for MST Courtesy Card, 4 for SBMTD Reduced Fare Mobility ID). See #2012 (comment) for more context.
Cases to try with
name
field (last name field):In all those cases, you should get a browser validation message that says "Please enter your last name."
Screenshots
Expand