From 2cde0d3f213873d62bf6c71ddbeaa4b042c60ba1 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Fri, 3 Jan 2025 07:09:44 +0100 Subject: [PATCH] Fixed dropdown/lookup & lookup-name fields being reset when hitting enter (#3724) --- .../models/lookup/dynamic-lookup.component.html | 7 ++++--- .../dynamic-scrollable-dropdown.component.html | 8 +++++--- src/app/shared/form/form.service.ts | 3 +++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.html index 89e7af9aa67..79f2756b249 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.html @@ -94,11 +94,12 @@ (scrolled)="onScroll()" [scrollWindow]="false"> - - + diff --git a/src/app/shared/form/form.service.ts b/src/app/shared/form/form.service.ts index 1ca844d690d..11fe5c54de3 100644 --- a/src/app/shared/form/form.service.ts +++ b/src/app/shared/form/form.service.ts @@ -153,6 +153,9 @@ export class FormService { } public addControlErrors(field: AbstractControl, formId: string, fieldId: string, fieldIndex: number) { + if (field.errors === null) { + return; + } const errors: string[] = Object.keys(field.errors) .filter((errorKey) => field.errors[errorKey] === true) .map((errorKey) => `error.validation.${errorKey}`);