luci-base: cbi.js: save filled out but not added dynlist items on apply
authorJo-Philipp Wich <jo@mein.io>
Fri, 13 Sep 2019 12:31:00 +0000 (14:31 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 13 Sep 2019 12:31:00 +0000 (14:31 +0200)
Fixes: #2938
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/cbi.js

index 400d25e09c0147be3f6c3bb15166ad72f8b4ff7b..d71a315da6120cc514d05dfc19067508df10ddeb 100644 (file)
@@ -1207,6 +1207,11 @@ function cbi_submit(elem, name, value, action)
                form.appendChild(hidden);
        }
 
+       var dynadd = form.querySelectorAll('input[data-dynlist-add="true"]');
+       for (var i = 0; i < dynadd.length; i++)
+               if (dynadd[i].value != '')
+                       dynadd[i].nextElementSibling.click();
+
        form.submit();
        return true;
 }