Skip to main content
Participant
Oct 25, 2018 3:43 PM UTC
Answered

List box and multiple selection - Populate new text box

Hello all..

I'm stuck and have been searching for a solution. I have a list box of 30 names. The user needs to select between 3 to 5 names. I am trying to get these names populated in a text box to the right of the list box. I can't find a solution for this and hope someone out there might have an idea. I've tried some JS scripts found here but none have worked so far.

Hope to hear from someone soon.

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Oct 26, 2018 4:47 PM UTC

You can use this code as the custom calculation script of the text field (just adjust the field name in the first line):

var v = this.getField("List Box1").value;

if (typeof v=="object") event.value = v.join(", ");

else event.value = v;

7 replies

Participant
Jun 23, 2020 11:00 PM UTC

Thanks try67!!!!! I'm new to making PDF Fillable forms.

Your response worked perfectly for me!!!!

 

Translate
Participant
Oct 26, 2018 4:58 PM UTC

Brilliant try67​

That was the simplest and most effective solution found. Greatly appreciate your help.

Translate
Participant
Oct 26, 2018 4:39 PM UTC

Anyone have an idea or a similar script I can compare?

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Oct 26, 2018 4:47 PM UTC

You can use this code as the custom calculation script of the text field (just adjust the field name in the first line):

var v = this.getField("List Box1").value;

if (typeof v=="object") event.value = v.join(", ");

else event.value = v;

Translate
Participant
Apr 6, 2023 8:32 PM UTC

TRY67,

 

Another beginner here. Please forgive my Javascript ignorance. I have a one off form to make with multiple selected states. I made a list box of the states but can't seem to get them to the text box. Where exactly does this code go? I have been trying to accomplish the same thing and I am sure I am putting the javascript or the list box/text box names in the wrong place.

Thanks,

Joe

Translate
Inspiring
Oct 25, 2018 6:43 PM UTC

First, this will require custom JavaScript to accomplish. Do you know how to write JavaScript within an Acrobat form?

See

currentValueIndices​ Example (Read) for coding.

Translate
Participant
Oct 25, 2018 6:49 PM UTC

Thanks;

I have a bit of experience modifying JS. I was hoping there might be some scripts that are similar to what I want to do and use that as a base.

The scripts I have seen so far don't seem to be what I am after. Basically, a user selects 3-5 items from the list box and these items get populated in a text box next to it. That's all I'm looking for.

Thanks

Translate