Skip to content
This repository has been archived by the owner on Nov 13, 2022. It is now read-only.

Fix error where form validation messages not appearing when expected. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexander89d
Copy link

Although form validation messages in the donation form and request form templates were set to appear when a form field had been edited and contained an invalid value (i.e. a user began to fill in and then cleared a field), these messages were not appearing when expected. Each form input tag in the form templates previously contained a declaration of a reference variable with identical name, "#name." Now, each input of each template declares a reference variable unique to that field of that template (e.g. "#phoneNumber"), and the div containing the error message uses the unique reference variable to check the state of the field. Error messages now appear as expected.

Since this error was present in both request-form.component.html and donation-form.component.html, identical changes have been made to each form template.

I based this contribution off of the guidance in the Angular Docs Template Syntax page's "Template Reference Variables" section.

Although form validation messages in the donation form and request form templates were set to appear when a form field had been edited and contained an invalid value (i.e. a user began to fill in and then cleared a field), these messages were not appearing when expected. Each form field previously contained a declaration of a reference variable with identical name, "#name." Now, each field of the template declares a reference variable unique to that field (e.g. "#phoneNumber"), and the div containing the error message uses the unique reference variable to check the state of the field. Error messages now appear as expected.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant