Expand my Community achievements bar.

Auto select items in a list

Avatar

Former Community Member
After adding items to a list box how do I select items in a list using Javascript?



eg.

In the initialize method for a list box

this.addItem("UNCLASSIFIED","U");

this.addItem("SPECIAL","S");



Can I do something like :

this.selectItem("UNCLASSIFIED");
3 Replies

Avatar

Former Community Member
Not exactly. You have to set the list box field's value to the value assigned to one of the items you added to it.



For example, to select the UNCLASSIFIED item, you would do this (in JavaScript) following your code to add the items:



this.rawValue = "U";


Stefan

Adobe Systems

Avatar

Former Community Member
Thanks. That worked. One thing worth mentioning is that if you have a multiSelect list then you can set multiple values by using:



this.ui.choiceList.open="multiSelect";

this.rawValue="A\nB\nC";



Where is this stuff documented? I'm just blindly trying things out.

Avatar

Former Community Member
Unfortunately, there's no definitive location for documentation on this stuff and it's a serious problem we need to solve.



For now, good places to look are these forums and the
Adobe LiceCycle Designer Developer Center.



Stefan

Adobe Systems