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

how to add item and value to dropdown list

Community Beginner ,
Jan 12, 2022 Jan 12, 2022

i make a secuired pdf file and want to let the company to add the pilot names as (values) and their IDs as (items) in the dropdown list, without reaching to my script.

i use this script:

function PopulateCabinCrewCode()

{ for (var i=10; i<20; i++) { this.getField("code" + i).setItems([

["", ""],

["41", "I.Amer "],

["46", "M.Mokhtar"]

]); } }

 

thanks in advance.

TOPICS
Create PDFs , How to , JavaScript , PDF forms
1.2K
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 ,
Jan 13, 2022 Jan 13, 2022
LATEST

Read this article and download the example script:

https://acrobatusers.com/tutorials/list_and_combo_in_lc/

 

While the article is about copying data between lists. It shows how individual items can be added and removed from a list. 

You'll find general information about scripting lists here:

https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm

 

And another list programming sample here:

https://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Community Expert ,
Jan 13, 2022 Jan 13, 2022

You can place items and values in a CSV file placed as an attachment in the PDF.

So your client just need to edit/replace the CSV file to update the dropdown.


Acrobate du PDF, InDesigner et Photoshopographe
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 ,
Jan 13, 2022 Jan 13, 2022

 how to make CSV file placed as an attachment in the PDF ?

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 ,
Jan 13, 2022 Jan 13, 2022

Hi,

 

A CSV file is just a file which contains items seperated by comma (or tabs) and each row is an entry

 

firstname, secondname

Bob, Marley,

Frank, Beard,

 

And you can attach it to a PDF searching for attach. and selecting "Attach File"

BarlaeDC_0-1642087187950.pngexpand image

Then you would need to change your code to read the values from the CSV File.

 

You can get all attachements using

//taken from AcrobatDC_js_api_reference.pdf
var d = this.dataObjects;
for (var i = 0; i < d.length; i++)
console.println("Data Object[" + i + "]=" + d[i].name);

 

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 ,
Jan 13, 2022 Jan 13, 2022
LATEST

Read this article and download the example script:

https://acrobatusers.com/tutorials/list_and_combo_in_lc/

 

While the article is about copying data between lists. It shows how individual items can be added and removed from a list. 

You'll find general information about scripting lists here:

https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm

 

And another list programming sample here:

https://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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