angular-dynamic-forms icon indicating copy to clipboard operation
angular-dynamic-forms copied to clipboard

Display Errors on Submit

Open Grijan opened this issue 1 year ago • 0 comments

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;
    }
  }

Grijan avatar Jan 29 '24 15:01 Grijan