Avatar

Level 8

There are a number of ways. Normally values wouldn't be stored as attributes as is in your case, so I find it easiest to use XPath instead of accessing the attribute through the scripting object model.

Put this in the change event of your first drop down where DropDownList2 is the name of your second dropdown:

DropDownList2.rawValue=null;

var elements = XMLData.applyXPath(xfa.data,"root/list/field[@code='"+xfa.event.newText+"']/*/@code");/**/

DropDownList2.clearItems();

if (elements.className=="dataValue")

DropDownList2.addItem(elements.value);

else{

for (var a=0;a<elements.length;a++)

  DropDownList2.addItem(elements.item(a).value);

}

Kyle