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

Populate Dropdown options from textfield

New Here ,
Aug 08, 2023 Aug 08, 2023

Hello, 

Im trying to have a dropdown menus options be populated based on the input in two other textfields

 

ex: I have a textfield named "buyerName1" and another named "buyerName2". I would like to have what is inputed into those two fields be the only 2 options available when you click on the dropdown field. This seems like it should be reletively simple but im having trouble finding a guide for it and im very new to Adobe. 

 

Thank you for any help you can provide!

TOPICS
Create PDFs , How to , PDF , PDF forms
261
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 ,
Aug 09, 2023 Aug 09, 2023

Try this as custom calculation script of dropdown field:

var b1 = this.getField("buyerName1").valueAsString;
var b2 = this.getField("buyerName2").valueAsString;
var drop = [];
if (event.source && (event.source.name=="buyerName1" || event.source.name=="buyerName2")) {
 if(b1)drop.push(b1);
 if(b2)drop.push(b2);
 if(drop.length !== 0)
 event.target.setItems(drop);
 else
 event.target.clearItems();}
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 ,
Aug 09, 2023 Aug 09, 2023

Thank you for the responce! I wasnt able to make this work but that might vary well be my fault.

I set this up under "Actions", Select trigger as "Mouse down", Select action as "Run JavaScript" and then copy and pasted the exact script you placed above. When I go to the sign section and click on the dropdown box all I get is a ding and nothing else. I also exported the PDF and tried it in another PDF application with the same result. Should I have placed this in a different area or restructed the script itself?

 

I do really appreciate the help as I have extremely limited experience with both Adobe and Javascript 🥹

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 ,
Aug 09, 2023 Aug 09, 2023
LATEST

As I wrote in my previous post, use it as 'custom calculation script' of dropdown field.

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