Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Drop Down List Help!!!!!

Avatar

Former Community Member
I'm trying to create a drop down list where when one value is selected another drop downlist appears. Each value on the first drop down list should bring up a whole different dropdown list. I can't seem to figure out how to go about doing this? I'm really bad at scripting! Any suggestions would be greatly appreciated! Thanks :)
1 Reply

Avatar

Level 1
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".