From 96336ddb1b721cba69a6d01700cdf8542076d17f Mon Sep 17 00:00:00 2001 From: Winnie <liang15@mcmaster.ca> Date: Mon, 2 Apr 2018 15:55:55 -0400 Subject: [PATCH] Update - Fix bug where previous ranks without following subranks would not update with blank dropdowns --- tomcat/webapps/Trawl/script.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tomcat/webapps/Trawl/script.js b/tomcat/webapps/Trawl/script.js index 79add29..753776d 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; } -- GitLab