From e5602beed99994900025c266091c999fcd9fa1a7 Mon Sep 17 00:00:00 2001 From: Thorge Petersen <petersen@rz.uni-kiel.de> Date: Fri, 8 Dec 2023 15:10:08 +0100 Subject: [PATCH] Fix empty options messing up selected options --- ckanext/odsh/templates/macros/form.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ckanext/odsh/templates/macros/form.html b/ckanext/odsh/templates/macros/form.html index a18f4201..5bbcec81 100644 --- a/ckanext/odsh/templates/macros/form.html +++ b/ckanext/odsh/templates/macros/form.html @@ -179,9 +179,11 @@ is_required=false) %} <select id="{{ 'field-' ~ (id or name) ~ '-value' if is_extra else (id or name) }}" name="{{ 'extras__' ~ index ~ '__value' if is_extra else (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 %} {% endfor %} </select> </div> -- GitLab