Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

select all in listbox

Avatar

Level 3

Hi guys,

I have a question.

I have a from xml populated listbox and want to select by pushing a button all populated items in the list.

this is my code.

the interesting thing is, that this code works before I import xml data, but as soon as i import xml data, it doesnt work anymore.

Do you have any idea, what the problem is and how can I fix it?

and second question. Is it possible deselect single items, when all are selected?

var temp1 = "";

for (i=0;i< PAGE3.ListBox1.length.rawValue;i++){

    temp1 = temp1 + ListBox1.getDisplayItem(i) + "\n";

  

}

ListBox1.rawValue = temp1

Thank you in advance for any help!!

Diana

4 Replies

Avatar

Level 6

The code should work as long as you set "Allow Multiple Selection" at design time.

However I will suggest small change to your code...try the following...

var temp1 = "";

for (i=0;i< PAGE3.ListBox1.length;i++){

    temp1 = temp1 + ListBox1.getDisplayItem(i) + "\n";

 

}

ListBox1.rawValue = temp1

Hold "Ctrl" btn for deselcting from the list.

Avatar

Level 3

Hi,

thanks for trying to help me, unfortunately the code still doesnt work:(

listbox is on multiple selection and I took out the rawValue from lenght., but it still doesnt want to select.

What can I do?

Thanks,

Diana

Avatar

Level 10

Here is a sample with the similar code that Varma had mentioned..

Make sure you have checked the Allow Multiple Selection in the ListBox properties.

https://acrobat.com/#d=QEZgjgKp4n1HLwEu5LSH1w

Thanks

Srini

Avatar

Level 6

Do me a favor try the follwoing JS code on your machine......with ButtonClick event.......Replace ListBox1 with actual hierarchy.

Hope you have selected "Allow Multiple Selection" for ListBox1 in Object>>Field tab.

If you still have difficulty you have my email .... n_varma(AT)lycos.com

xfa.host.messageBox(""+ListBox1.rawValue);
var temp1 = "";

for (i=0;i< ListBox1.length;i++){
    temp1 = temp1 + ListBox1.getDisplayItem(i) + "\n";
}

ListBox1.rawValue = temp1;

xfa.host.messageBox(""+ListBox1.rawValue);