These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

List Box multiple selects script

funkyfermin
Registered: Sep 19 2011
Posts: 2

I'm using a drop down with a list of values (example "Manager, super, user"), when I select one I want my List Box to populate more then one value. the code below will only select the last value which in this case would be "Value3". How would I get it to only select value1 and value2 as an example?
 
if (this.rawValue == "Manager") then
listboxname.rawValue = "Value1"
listboxname.rawValue = "Value2"
listboxname.rawValue = "Value3"
endif

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

you can use this script in the change:Event of the dropdown list.

  1. if (xfa.event.newText === "Manager") {
  2. Listfield1.clearItems();
  3. Listfield1.addItem("Value1");
  4. Listfield1.addItem("Value2");
  5. Listfield1.addItem("Value3");
  6. }
  7. else if (xfa.event.newText === "Superuser") {
  8. Listfield1.clearItems();
  9. Listfield1.addItem("Value4");
  10. Listfield1.addItem("Value5");
  11. Listfield1.addItem("Value6");
  12. }
  13. else
  14. {
  15. Listfield1.clearItems();
  16. }

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

funkyfermin
Registered: Sep 19 2011
Posts: 2
OOO Radzmar, thats good and I will use it on another section that I had issue with but my fault on my explanation.

My multiple select list box is already populated. When I want to happen is when I select "Manager" from my dropdown list I wanted the script to select the items I want in the prepopulated list box. So value1 value2 are already in the list box I just need the script to select the items I want based off the drop downdown selection.

So my list box has "Value1, Value2, Value3, Value4, Value5. So if I select Manager from my drop down, I only want Value1 and Value 2 selected. If i select Superusers from the drop down I want value1 vaule2, value3 select in the list box.