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

How do I get a dropdown list to provide more information once the choice is selected from the list?

New Here ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

I am working on creating a form for my company. One of the questions on the form is asking for them to select a location. How can I get each locations' Location Name, Address, Telephone # & Fax # to populate within the field once the Location Name is selected from the drop down?

TOPICS
How to , PDF forms

Views

285

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
community guidelines
Community Expert ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

As 'Validation' script of Dropdown field use something like this:

var f1 = this.getField("Location Name");
var f2 = this.getField("Address");
var f3 = this.getField("Telephone");
var f4 = this.getField("Fax");
switch(event.value){
case "Location1":
f1.value = "Location1 Name goes here";
f2.value = "Location1 address goes here";
f3.value = "Location1 telephone number goes here";
f4.value = "Location1 fax number goes here";
break;

case "Location2":
f1.value = "Location2 Name goes here";
f2.value = "Location2 address goes here";
f3.value = "Location2 telephone number goes here";
f4.value = "Location2 fax number goes here";
break;

default:
f1.value = "";
f2.value = "";
f3.value = "";
f4.value = "";}

 

Change field names to your actual field names and add more locations (before 'default' line) also  "Location1" and "Location2" are just examples, change those to your actual dropdown choices you have for locations.

In dropdown field properties, under options tab, check 'Commit selected value immediately'.

Votes

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
community guidelines
New Here ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

Where would I put this script? I have not used the Validation feature before.

 

I have found a way to put all of the information into the drop-down, but I would prefer to only show the Location Names in the drop-down instead of all of the information if that makes sense.

 

Emily24109048wmi6_0-1650401464226.png

 

Votes

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
community guidelines
Community Expert ,
Apr 19, 2022 Apr 19, 2022

Copy link to clipboard

Copied

Put it at validation of the dropdown field.

Votes

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
community guidelines
Community Expert ,
Apr 27, 2022 Apr 27, 2022

Copy link to clipboard

Copied

LATEST

Read this article:

https://www.pdfscripting.com/public/Editing-Fields-Properties.cfm

 

Are here are two articles that cover the question you've asked. While the article use the Keystroke event, they can be easily modified for use in the validation event. 

https://acrobatusers.com/tutorials/change_another_field/

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

 

 

 

 

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

Votes

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
community guidelines