From b374704ec075e08cc1a3284746f9758284417715 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Menne?= Date: Sun, 12 Jan 2025 14:23:31 +0100 Subject: [PATCH] Add dynamic naming to selects, in order to enable recursive forms --- georeport/static/georeport/recurse_selection.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/georeport/static/georeport/recurse_selection.js b/georeport/static/georeport/recurse_selection.js index 0c78df2..dba6c99 100644 --- a/georeport/static/georeport/recurse_selection.js +++ b/georeport/static/georeport/recurse_selection.js @@ -1,3 +1,7 @@ +/* + * Copyright: (c) 2025, Jörn Menne + * GNU General Public License v3.0 (see LICSENE or https://www.gnu.org/license/gpl-3.0.md) +*/ var level = 0 function getsubcats(element) { const id = element.id;; @@ -30,6 +34,7 @@ function getsubcats(element) { let subcats = data["subcategories"]; if (subcats.length == 0) { let oldselect = document.getElementById(level); + rootselect.name = "category"; if (oldselect) { form.removeChild(oldselect); oldselect.remove(); @@ -50,6 +55,8 @@ function getsubcats(element) { select.onchange = function () { getsubcats(this); } + select.name = "category"; + rootselect.name = "root"; var option = document.createElement("option"); option.value = ""; @@ -76,7 +83,6 @@ function getsubcats(element) { } -// TODO: name changes // TODO: Better IDs for new selections // TODO: Labels for selection*/ // TODO: Tidy up -- 2.39.5