Changes in order to keep server side validation errors into the submission form state

This commit is contained in:
Giuseppe Digilio
2021-05-14 19:23:03 +02:00
parent 0724692d40
commit 44d2310cdb
20 changed files with 265 additions and 131 deletions

View File

@@ -254,6 +254,13 @@ export class FormComponent implements OnDestroy, OnInit {
onBlur(event: DynamicFormControlEvent): void {
this.blur.emit(event);
const control: FormControl = event.control;
const fieldIndex: number = (event.context && event.context.index) ? event.context.index : 0;
if (control.valid) {
this.formService.removeError(this.formId, event.model.name, fieldIndex);
} else {
this.formService.addControlErrors(control, this.formId, event.model.name, fieldIndex);
}
}
onCustomEvent(event: any) {