Skip to main content
Participant
October 25, 2018
Answered

List box and multiple selection - Populate new text box

  • October 25, 2018
  • 4 replies
  • 4342 views

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 has been closed for replies.
Correct answer try67

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;

4 replies

Participant
June 23, 2020

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

Your response worked perfectly for me!!!!

 

Participant
October 26, 2018

Brilliant try67

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

Participant
October 26, 2018

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

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 26, 2018

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;

Participant
April 6, 2023

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

Inspiring
October 25, 2018

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.

Participant
October 25, 2018

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