Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 2939:5d7e33fd00d8
Fixed #233 for radios
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Tue, 12 Sep 2017 19:22:21 +0100 |
parents | 151fae569ce9 |
children | 8805556c0f42 9cdcde1dafd8 |
comparison
equal
deleted
inserted
replaced
2938:76c06bd88bbe | 2939:5d7e33fd00d8 |
---|---|
835 var optHold = this.popupResponse; | 835 var optHold = this.popupResponse; |
836 console.log("Radio: " + node.specification.statement); | 836 console.log("Radio: " + node.specification.statement); |
837 node.response = null; | 837 node.response = null; |
838 var i = 0; | 838 var i = 0; |
839 var inputs = optHold.getElementsByTagName('input'); | 839 var inputs = optHold.getElementsByTagName('input'); |
840 while (node.response === null) { | 840 var checked; |
841 while (checked === undefined) { | |
841 if (i == inputs.length) { | 842 if (i == inputs.length) { |
842 if (node.specification.mandatory === true) { | 843 if (node.specification.mandatory === true) { |
843 interfaceContext.lightbox.post("Error", "Please select one option"); | 844 interfaceContext.lightbox.post("Error", "Please select one option"); |
844 return false; | 845 return false; |
845 } | 846 } |
846 break; | 847 break; |
847 } | 848 } |
848 if (inputs[i].checked === true) { | 849 if (inputs[i].checked === true) { |
849 node.response = node.specification.options[i]; | 850 checked = inputs[i]; |
850 console.log("Selected: " + node.specification.options[i].name); | |
851 } | 851 } |
852 i++; | 852 i++; |
853 } | 853 } |
854 var option = node.specification.options.find(function (a) { | |
855 return checked.id == a.name; | |
856 }); | |
857 if (option === undefined) { | |
858 interfaceContext.lightbox.post("Error", "A configuration error has occured, the test cannot be continued"); | |
859 throw ("ERROR - Cannot find option"); | |
860 } | |
861 node.response = option; | |
854 processConditional.call(this, node, node.response.name); | 862 processConditional.call(this, node, node.response.name); |
855 return true; | 863 return true; |
856 } | 864 } |
857 | 865 |
858 function processRadioConditional(condition, response) { | 866 function processRadioConditional(condition, response) { |