changeset 3025:c93687862a79

Merge branch 'vnext' into Dev_main
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 12 Sep 2017 19:24:03 +0100
parents c29ef0cc741f (current diff) 9cdcde1dafd8 (diff)
children b09e9b7ef246
files js/core.js
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Tue Sep 12 19:07:14 2017 +0100
+++ b/js/core.js	Tue Sep 12 19:24:03 2017 +0100
@@ -837,7 +837,8 @@
         node.response = null;
         var i = 0;
         var inputs = optHold.getElementsByTagName('input');
-        while (node.response === null) {
+        var checked;
+        while (checked === undefined) {
             if (i == inputs.length) {
                 if (node.specification.mandatory === true) {
                     interfaceContext.lightbox.post("Error", "Please select one option");
@@ -846,11 +847,18 @@
                 break;
             }
             if (inputs[i].checked === true) {
-                node.response = node.specification.options[i];
-                console.log("Selected: " + node.specification.options[i].name);
+                checked = inputs[i];
             }
             i++;
         }
+        var option = node.specification.options.find(function (a) {
+            return checked.id == a.name;
+        });
+        if (option === undefined) {
+            interfaceContext.lightbox.post("Error", "A configuration error has occured, the test cannot be continued");
+            throw ("ERROR - Cannot find option");
+        }
+        node.response = option;
         processConditional.call(this, node, node.response.name);
         return true;
     }