Expand my Community achievements bar.

SOLVED

List box Multiple Selection Exports only one option

Avatar

Level 2

Dear all,

I have created my list box, have enabled multiple selections and am sending out the interactive pdf.

However when i get it back and extract the data, I will only get one selection in the csv file.

Also I would like to automatically select all the entries in a list box. How would I do that?

Thanks for the help. I have been roaming the Internet for an answer but have not found what I needed yet.

Cheers,

Larissa

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Steve Walker has a good example of populating listboxes here: Drop-down list automatic add-on

Hope that helps,

Niall

View solution in original post

9 Replies

Avatar

Level 2

I've been thinking about my problem and I think what would be best to do is to concatenate all the options of a list box in a text box which I would then export.

Can someone help me with the script? I've tried with If, concat... but all to no avail.

Thanks,

Larissa

Avatar

Level 10

Hi Larissa,

Here is a sample: https://acrobat.com/#d=Ac7WhJmi344P4mjEDEVAXg

If you export to XML it will maintain all of the selections in the list box. Alternatively you can set up a hidden textfield to poll the choices in the list box and export that to csv.

Hope that helps,

Niall

ps

Sorry, meant to include a snap of the xml data:

jEdit.png

Avatar

Level 2

Hi Niall,

I've seen it work in XML but the person who will be evaluating the results needs to see everyting in Excel.

Could you help me on the polling idea? I think that would be the way to go.

As said before I tried with concat etc. but did not get the results. I think I am missing a trivial piece of scripting language to do what I want to.

Thanks for the help.

Cheers,

Larissa

Avatar

Level 10

Hi,

Were you able to look at the sample?

The calculate event of the textfield has the following javascript:

this.rawValue = ListBox1.rawValue; 

The textfield could be set to hidden, so that the user does not see it. You could then export this texfield to the csv file.

Niall

Avatar

Level 10

You can get the selected values from the list box using the following script.

The multiple values will be separated by a new line character.

var vList = ListBox1.rawValue.split("\n");

var sXML = "";

for (var i = 0; i < vList.length; i++)

{

       xfa.host.messageBox("value " +  vList[i]);

}

Thanks

Srini

Avatar

Level 2

Hi Niall,

Thanks, that works great. If I could only see the automatic select script that was posted beforehand, I would be good to go.

Any chance, you can open it and just post the code?

Thanks,

Larissa

Avatar

Level 2

Hi Srini,

Thanks for this. Would that work when I export into CSV as well or only with XML?

Cheers,

Larissa

Avatar

Level 2

One more thing Niall,

I have two list boxes where one populates the other with a selection using this script.

ListBox0.addItem(xfa.event.newText) in Javascript on the change event.

How would I be able to make sure that no double entries can appear in the second list box?

Thank a ton,

Larissa

Avatar

Correct answer by
Level 10

Hi,

Steve Walker has a good example of populating listboxes here: Drop-down list automatic add-on

Hope that helps,

Niall