From eca1ac3e539ed3bb6d44431cccc8f0cb5e0ad0d3 Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Mon, 26 Jul 2021 11:15:07 +0200
Subject: [PATCH] Temporary fix for number input fields and invalid values

---
 projects/common/form-element-component.directive.ts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/projects/common/form-element-component.directive.ts b/projects/common/form-element-component.directive.ts
index d6c661d0a..50a9ae34e 100644
--- a/projects/common/form-element-component.directive.ts
+++ b/projects/common/form-element-component.directive.ts
@@ -34,7 +34,9 @@ export abstract class FormElementComponent extends ElementComponent implements O
         pairwise()
       )
       .subscribe(([prevValue, nextValue] : [string | number | boolean | undefined, string | number | boolean]) => {
-        this.formValueChanged.emit({ id: this.elementModel.id, values: [prevValue, nextValue] });
+        if (nextValue != null) { // invalid input on number fields generates event with null TODO find a better solution
+          this.formValueChanged.emit({ id: this.elementModel.id, values: [prevValue, nextValue] });
+        }
       });
   }
 
-- 
GitLab