For example
Provide these listboxs with LC Designer.
ListBox1 (visible, and has items "A", "B")
ListBox2 (invisible, no item)
and following javascript .....
//////
// form1.#subform[0].ListBox1::change - (JavaScript, client)
//////
var str_itemtext = xfa.event.newText;
var olist2 = xfa.resolveNode("form1.#subform[0].ListBox2");
var arrayA = new Array("a", "b", "c");
var arrayB = new Array("d", "e", "f");
if (str_itemtext == "A") {
makelist(olist2, arrayA);
olist2.presence = "visible";
}
else if (str_itemtext == "B"){
makelist(olist2, arrayB);
olist2.presence = "visible";
}
function makelist(olist, arrayitem) {
var i = 0;
olist.clearItems();
for (i = 0; i < arrayitem.length; i ++){
olist.addItem(arrayitem[i], arrayitem[i]);
}
}
///////
Save the form as Dynamic XML Form. (not Static Form)
And open the pdf with Acrobat8.
If you choose "A" on ListBox1, ListBox2 (with items "a", "b", "c") will appear.
After, if you choose "B" , ListBox2's items will change to "d", "e", "f".