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

Saving multiple selections from Listbox to Text Field

Not applicable
I have a listbox with the 'Allow Multiple Selections' option checked. I would like to save the items the user selects to a text field to cut down on volume when the form is printed.



I placed this Javascript on the Change option, but it only records the last item selected. How can I record all of the selections?



var sNewValue = this.boundItem(xfa.event.newText)

TextField1.rawValue = sNewValue



Thanks!



Andi
2 Replies
pguerett
Level 10
Level 10
The selections are only committed on the exit event of the listbox (when it is multiselect). So on the exit event if you query the rawValue property you will get all of the selections the user made.



The code that you are using will only give you the last entry the user made.



So your code should be moved to the Exit event and it should look like this:



TextField1.rawValue = this.rawValue;



Make sure your text field is multi-line because you will get a CR at the end of each selection. You can use Javascript to parse out the CR to get a single line if you wish.
Not applicable
Awesome! Thank you so much - Andi