-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Messages don't show up after markAsTouched #64
Comments
I'm still looking into the source to see if I can submit a decent PR. As a workaround I put lots of
|
What's the use case of calling touch without submit? |
We don't want to submit the form on initialization, I'm pretty sure we can't (well, maybe through formgroup.parent.parent). I'm only working on one formgroup (well an array of formgroups but all under one formControl), which has the "show validation errors on startup" requirement. The other controls on the main form section always have the same validation, and is managed by another team. The form as a whole doesn't care what we put on our section. We don't even have access to the form submit function, we get access to the submitted data after form submit via actions in the redux store, which only happens if the whole form is valid. We can then submit the data from our section of the form to our servers, while they send the outer data to their servers. I guess if we had access to the whole form, we could do a form submit after initialization, and ignore the first submit in the submit function. |
@NetanelBasal This feature is interesting for us too. We do not allow submitting the form by default. In our case If the user selects a radio button, which changes the validators and so we want to display the error instant (fields are markes as touched). So it would be greate to consider such a feature. |
I don't mind seeing a PR. |
I successfully tested a couple of possible solutions to listen for when a control becomes @NetanelBasal Any thoughts? If you're still interested, I can give it a try and open a PR. Let me know! |
Sure |
@NetanelBasal To make sure I don't miss anything, in the documentation for
|
I didn't wrote it, but it means that you can even override one property. It's a redundant sentence probably. |
I'm submitting a...
Current behavior
Messages don't show up after
formGroup.markAllAsTouched();
orformGroup.controls[control].markAsTouched();
. Though, angular material highlights the invalid fields.Expected behavior
Messages should show up after
markAsTouched
.Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/error-tailor-mark-as-touched
What is the motivation / use case for changing the behavior?
Highlighting invalid fields after validation requirements have changed, and the user revisits the form to correct previously valid but now invalid sections.
Environment
The text was updated successfully, but these errors were encountered: