From 261dcd07e592e64dac42636747841fb7d75a7116 Mon Sep 17 00:00:00 2001
From: Thorge Petersen <petersen@rz.uni-kiel.de>
Date: Wed, 21 Feb 2024 15:54:14 +0100
Subject: [PATCH] Allow empty option values in autocomplete select

---
 ckanext/odsh/templates/macros/form.html | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/ckanext/odsh/templates/macros/form.html b/ckanext/odsh/templates/macros/form.html
index c69c12d9..610a9b69 100644
--- a/ckanext/odsh/templates/macros/form.html
+++ b/ckanext/odsh/templates/macros/form.html
@@ -176,11 +176,9 @@ is_required=false) %}
       <select id="{{ (id or name) }}" name="{{ name }}" 
               {{ attributes(attrs) }} data-module="autocomplete"{% if is_multiple %} multiple{% endif %}>
           {% for option in options %}
-            {% if option.key %}
-              <option value="{{ option.key }}"{% if option.key in selected %} selected="selected"{% endif %}>
-                  {{ option.text or option.value }}
-              </option>
-            {% endif %}
+            <option value="{{ option.key or '' }}"{% if option.key in selected %} selected="selected"{% endif %}>
+              {{ option.text or option.value }}
+            </option>
           {% endfor %}
       </select>
     </div>
-- 
GitLab