Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

List box and multiple selection - Populate new text box

Community Beginner ,
Oct 25, 2018 Oct 25, 2018

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.

TOPICS
Create PDFs
4.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Oct 26, 2018 Oct 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;

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 25, 2018 Oct 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 25, 2018 Oct 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 26, 2018 Oct 26, 2018

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2018 Oct 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;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2023 Apr 06, 2023
LATEST

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 26, 2018 Oct 26, 2018

Brilliant try67​

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 23, 2020 Jun 23, 2020

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

Your response worked perfectly for me!!!!

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines