You look like good in JS....here is an idea I would follow.....
Since data need to be related some where I would start with the query that feeds the data in to the form. I would pull up the data as one column madeup of two parts sapated by some special char like "~" instead of two saparate columns.
Then I would add a Global variable with name "GplantSiteList".
Then I would modify your code like following.........
var nItems = plant_site.resolveNode("#items").nodes;
var count = nItems.length;
var plantSiteList = ""; //var to hold combination list of plant and sites
var singleDataItem = ""; //var to collect row items from table
var oldinfo = ""; //for comparision
for (var i = 0; i < count; i++) {
singleDataItem = nItems.item(i).value;
singleDataItem = singleDataItem.split("~"); //split at special char
if (oldinfo != singleDataItem(0)) {
oldinfo = singleDataItem(0); //assign the first part to the plant
plantSiteList = plantSiteList + "***" +singleDataItem(0)+ "#" +singleDataItem(1); //*** is saparater between the sets of values # is saparater between Site values
}else {
plantSiteList = plantSiteList + "#" +singleDataItem(1); //# is saparater between Site values;
}
} //end for
GplantSiteList.value = plantSiteList; //save this value in a global variable
plant_site.clearItems();
plantSiteList = plantSiteList.split("***");
var loadValue;
for (var i = 1; i < plantSiteList.length; i++) {
loadValue = plantSiteList(i)
loadValue = loadValue.split("#");
plant_site.addItem(loadValue(0));
} //end for
Then to load second dd I would add following code under "change" event of the Plant DD
var selectPlant = xfa.event.change; //capture the plant value that is just selected
var plantSiteList;
plantSiteList = GplantSiteList.value; //retrive the global variable
site_list.clearItems(); //assuming site_list is the name of the DD
plantSiteList = plantSiteList.split("***");
var loadValue;
for (j=1;j<plantSiteList.length;j++) {
loadValue = plantSiteList(j)
loadValue = loadValue.split("#");
if (selectPlant == loadValue(0)) {
for (k=1;k<loadValue.length;k++) {
site_list.addItem(loadValue(k));
}
exit; //exit for once satisfied
}
} //end for
hope that helps...........
Good luck