From eeb24cb578519a71d3978bd951c32f04c71c8928 Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Fri, 15 Sep 2023 10:07:03 +0200
Subject: [PATCH] Include empty strings in fn isEmpty(val)

---
 ipmd/static/ipmd/js/ipmdlib.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipmd/static/ipmd/js/ipmdlib.js b/ipmd/static/ipmd/js/ipmdlib.js
index 402b9624..0963a9eb 100644
--- a/ipmd/static/ipmd/js/ipmdlib.js
+++ b/ipmd/static/ipmd/js/ipmdlib.js
@@ -521,13 +521,13 @@ function getUnix(aDate)
 }
 
 /**
- * Saves a bit of typing. Currently checks if the val is either undefined or null
+ * Saves a bit of typing. Currently checks if the val is either undefined or null, and if a string == ""
  * @param {Object} val 
  * @returns {Boolean} true if the value is considered empty
  */
 function isEmpty(val)
 {
-    return val === undefined || val === null;
+    return val === undefined || val === null || (typeof val === "string" && val.trim() == "");
 }
 
 // Keeping track of maps
-- 
GitLab