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

Display Errors on Submit #1

Open
Grijan opened this issue Jan 29, 2024 · 0 comments
Open

Display Errors on Submit #1

Grijan opened this issue Jan 29, 2024 · 0 comments

Comments

@Grijan
Copy link

Grijan commented Jan 29, 2024

Hi @martinstefanovic wonderful code base for those who are working with Dynamic forms. But how to handle to display the errors on submit before entring any values, cuz the errors are triggered only when there is a change in the input, so basically the form loads and the users clicks on submit, how to handle it.

Thanks in advance.

onChange(event: Event) {
    const formGroup = this.controlContainer.control as FormGroup;

    this.errors = formGroup.controls[this.options.formControlName].errors;
    if (this.errors) {
      this.errors.errorMessage = this.options?.errorMessage;
    }
  }
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