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

Custom validation messages not working in in-person eligibility form #2337

Closed
angela-tran opened this issue Sep 5, 2024 · 2 comments · Fixed by #2377
Closed

Custom validation messages not working in in-person eligibility form #2337

angela-tran opened this issue Sep 5, 2024 · 2 comments · Fixed by #2377
Assignees
Labels
bug Something isn't working

Comments

@angela-tran
Copy link
Member

The mockups show that the in-person eligibility form should show custom validation messages - "Please choose an eligibility type." for the radio buttons and "Please confirm you have used an agency policy to verify eligibility." for the checkbox.

The current implementation in #2317 is using our generic form.html template to render the forms, which has logic to handle custom validation messages, so it should just work, but it is not. Let's debug it.

@angela-tran
Copy link
Member Author

angela-tran commented Sep 11, 2024

I found out that the problem is in this line:

$("button[type=submit]", "#{{ form.id }}").on("click", function(e) {

Here we're passing in a selector of button[type=submit] and a context of #{{ form.id }} to find the submit button that should trigger validation logic. But in in_person/eligibility.html, the submit button is not inside the <form> element; instead it's outside the <form> element and has a form attribute, which is also a valid approach.

I think we could fix this by adding a query for a button[type=submit] with a form attribute of #{{ form.id }} if the existing query doesn't find anything.

@thekaveman
Copy link
Member

I think we could fix this by adding a query for a button[type=submit] with a form attribute of #{{ form.id }}

Take a look at the .add() jQuery helper.

@lalver1 lalver1 self-assigned this Sep 18, 2024
@lalver1 lalver1 moved this from Todo to In progress in Digital Services Sep 18, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Digital Services Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants