From 38b4412f8b6cf21371b67e8de917f5a24b2bf72d Mon Sep 17 00:00:00 2001
From: Parker Berberian <pberberian@iol.unh.edu>
Date: Mon, 8 Jul 2019 16:39:54 -0400
Subject: Fixes and adds Tests

Fixes old tests and adds some more.
Also fixes linting errors

Change-Id: If84f0ed2dab5f9ffa7ce2deb92e058b0076d9154
Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
---
 .../config_bundle/steps/define_software.html       | 25 +++++++++++-----------
 1 file changed, 12 insertions(+), 13 deletions(-)

(limited to 'src/templates')

diff --git a/src/templates/config_bundle/steps/define_software.html b/src/templates/config_bundle/steps/define_software.html
index 7c47569..43f3f5d 100644
--- a/src/templates/config_bundle/steps/define_software.html
+++ b/src/templates/config_bundle/steps/define_software.html
@@ -27,20 +27,19 @@
 
 {% block tablejs %}
 <script>
-
     document.getElementById("radio_{{headnode}}").checked = true;
 
+    function radio_pre_submit(){
+        var parents = document.getElementsByClassName("table_hidden_input_parent");
+        for(const node of parents){
+            const radio = node.getElementsByClassName("my_radio")[0];
+            const checkbox = radio.nextElementSibling;
+            if(radio.checked){
+                checkbox.value = "True";
+            }
+        }
+    }
+
+    form_submission_callbacks.push(radio_pre_submit);
 </script>
 {% endblock tablejs %}
-
-
-{% block onleave %}
-var parents = document.getElementsByClassName("table_hidden_input_parent");
-for(var i=0; i<parents.length; i++){
-    var node = parents[i];
-    var radio = node.getElementsByClassName("my_radio")[0];
-    var checkbox = radio.nextElementSibling;
-    if(radio.checked){
-        checkbox.value = "True";
-    }
-}
-- 
cgit