From 7a8fb389b705bb504d39f7b6655594677aa3fb80 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Mon, 17 Jul 2023 17:29:04 +0300 Subject: [PATCH] RED-6973: Fixed enter not submitting the form. --- .../file-attribute/file-attribute.component.html | 2 +- .../file-attribute/file-attribute.component.ts | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.html b/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.html index b4c80aaa1..e27032dd8 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.html +++ b/apps/red-ui/src/app/modules/dossier-overview/components/file-attribute/file-attribute.component.html @@ -40,7 +40,7 @@
-
+ { const attrValue = fileAttributes[key]; - config[key] = [ - dayjs(attrValue, 'YYYY-MM-DD', true).isValid() ? dayjs(attrValue).toDate() : attrValue, - Validators.pattern(/^(\s+\S+\s*)*(?!\s).*$/), - ]; + config[key] = [dayjs(attrValue, 'YYYY-MM-DD', true).isValid() ? dayjs(attrValue).toDate() : attrValue]; + }); + return this._formBuilder.group(config, { + validators: control => + control.get(this.fileAttribute.id).value && + !control.get(this.fileAttribute.id).value.trim().length && + !this.fileAttributeValue + ? { emptyString: true } + : null, }); - return this._formBuilder.group(config); } #formatAttributeValue(attrValue) { - return this.isDate ? attrValue && dayjs(attrValue).format('YYYY-MM-DD') : attrValue.replaceAll(/\s\s+/g, ' '); + return this.isDate ? attrValue && dayjs(attrValue).format('YYYY-MM-DD') : attrValue.trim().replaceAll(/\s\s+/g, ' '); } #toggleEdit(): void {