Highlighted

select all in listbox

dfjalsdjflsadk

13-08-2010

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

Replies

Highlighted

Varma_LC

13-08-2010

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.

Highlighted

dfjalsdjflsadk

16-08-2010

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

Highlighted

Srini_Dhulipall

16-08-2010

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

Highlighted

Varma_LC

16-08-2010

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);