diff --git a/tomcat/webapps/Trawl/script.js b/tomcat/webapps/Trawl/script.js index 79add29455d828bbc52b60b5bc1b63ab9532f0ba..753776d71102aac214c64d674fb4ccf14ff51303 100644 --- a/tomcat/webapps/Trawl/script.js +++ b/tomcat/webapps/Trawl/script.js @@ -33,11 +33,18 @@ function callUpdateSci(object){ function populateDropdown(childTagID, nodeList, subnode){ var x, y, content=""; - for (var i in nodeList[subnode]["taxonName"]){ - x = nodeList[subnode]["taxonId"][i]; - y = nodeList[subnode]["taxonName"][i]; - content += '"<option value="' + x + '">' + y + '</option>'; + console.log(nodeList[subnode]); + if(nodeList[subnode] != null){ + for (var i in nodeList[subnode]["taxonName"]){ + x = nodeList[subnode]["taxonId"][i]; + y = nodeList[subnode]["taxonName"][i]; + content += '"<option value="' + x + '">' + y + '</option>'; + } } + // else { + // content + // } + document.getElementById(childTagID).innerHTML = content; }