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

Unexpected validation behaviour for subforms // angular/material #202

Closed
lgaida opened this issue Jan 15, 2021 · 1 comment
Closed

Unexpected validation behaviour for subforms // angular/material #202

lgaida opened this issue Jan 15, 2021 · 1 comment

Comments

@lgaida
Copy link

lgaida commented Jan 15, 2021

Hi there!

I like this lib a lot and i'm currently using it with angular/material. It basically forces you to implement clean and reusable form-components :)

My issue:
I just split a form into a root and a sub form and am now getting unexpected behaviour with the error-messages/field validation.
Previously i used a large root form and when i clicked the submit button mat-errors would show up on any invalid inputs.
After splitting up the form mat-errors only show up on the root form inputs but not on the sub form inputs.
See my example at stackblitz.

My current workaround is to simply disable the submit button until the formGroup is valid, which does not feel right. I want the user to actually see the error messages / highlighted fields when he forgot to fill an input.

Whats more interesting to me: i'm already using an automatic-root form with sub forms inside a mat-stepper where everything works fine as long as the stepper handles the submission.
E.g
<mat-stepper <mat-step [stepControl]="myRootForm"> <app-root-form #myRootForm> <!-- this component uses multiple sub-forms --> ... </app-root-form> </mat-step>

Greetings!

@lgaida
Copy link
Author

lgaida commented Jan 15, 2021

Nevermind. Just found issue #155
Looks like i used the wrong keyword the first time i searched for similar issues.

@lgaida lgaida closed this as completed Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant