]> git.menne-pb.de Git - pinpoint.git/commitdiff
Add dynamic naming to selects, in order to enable recursive forms
authorJörn Menne <jmenne@fedora.de>
Sun, 12 Jan 2025 13:23:31 +0000 (14:23 +0100)
committerJörn Menne <jmenne@fedora.de>
Mon, 13 Jan 2025 10:06:09 +0000 (11:06 +0100)
georeport/static/georeport/recurse_selection.js

index 0c78df265e42ad9a0b9f57150ad170850f0e9c8c..dba6c998e15b08dc9cf7dd4f59de6c04bf762279 100644 (file)
@@ -1,3 +1,7 @@
+/* 
+ * Copyright: (c) 2025, Jörn Menne <jmenne@posteo.de>
+ * 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