Listbox selection in a new Textfield adobe acrobat pro

Community Beginner ,
Dec 09, 2020

Copy link to clipboard

Copied

Dear Community,

I've a Listbox in adobe acrobat pro with following words: Telephone, Computer, Mobile, Notebook, if i select one or more words from the Listbox, the selected word should in a new Texflied for example :

1. Telephone

2. Mobile

3. Notebook

Many thanks for your answer/ help.

 

Best Regards

Noel

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

21

Likes

Translate

Translate

Report

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

Listbox selection in a new Textfield adobe acrobat pro

Community Beginner ,
Dec 09, 2020

Copy link to clipboard

Copied

Dear Community,

I've a Listbox in adobe acrobat pro with following words: Telephone, Computer, Mobile, Notebook, if i select one or more words from the Listbox, the selected word should in a new Texflied for example :

1. Telephone

2. Mobile

3. Notebook

Many thanks for your answer/ help.

 

Best Regards

Noel

TOPICS
Acrobat SDK and JavaScript, Create PDFs, How to, PDF forms

Views

22

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 09, 2020 0
ls_rbls LATEST
Adobe Community Professional ,
Dec 18, 2020

Copy link to clipboard

Copied

You can add a custom calculation script in the text field where you want the multiple selection values of the List Box to be populated into:

 

// Declare your variables
var f = this.getField("myListBox");
var a = f.currentValueIndices;

// Get multiple selections from the listbox and copy the values in this field
for (var i = 0; i < a.length; i ++)
//event.value += "\n"+ f.getItemAt(a[i], false);
event.value += f.getItemAt(a[i], false);


// Get single or more selections altogether from the listbox and populate this textfield

if ((typeof a == "number") && (a ==0)) event.value ="";

if (((event.value !=="") || (event.value =="")) && (typeof a == "number")) event.value += "\n"+ f.getItemAt(a, false); 

 

And in the list box field refer to the slide below to see how to setup the listed items and field properties.

 

listbox2.png

 

When you set it up like this you may make more than one selectin in the listbox by keeping the CTRL key pressed in your keyboard and left-clicking on items with your mouse pointer. 

 

After the selections are made in your listbox, left-click once with the mouse pointer inside or on the text field where you have the custom script,  and the values will autopopulate in that field.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 18, 2020 0