• 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 make a dropdown field auto populate two other fields?

New Here ,
Sep 11, 2018 Sep 11, 2018

Copy link to clipboard

Copied

I've been trying for 3 days to make it where when I chose an address in a dropdown, and have it auto populate the phone and fax number to no avail. I'm using Adobe Acrobat Pro DC. Any help would be appreciated. Thank you.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

652

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

correct answers 1 Correct answer

Community Expert , Sep 12, 2018 Sep 12, 2018

Remove the line numbers from the code. They should not have been a part of it if you copied it from the website.

Votes

Translate

Translate
Community Expert ,
Sep 11, 2018 Sep 11, 2018

Copy link to clipboard

Copied

You can use something like this as the custom validation script of the drop-down field:

if (event.value=="Main Street 1") {

    this.getField("PhoneNumber").value = "555 999 1234";

    this.getField("FaxNumber").value = "555 999 1235";
} else if (event.value=="Maple Street 12") {

    this.getField("PhoneNumber").value = "555 678 1234";

    this.getField("FaxNumber").value = "555 678 1235";

} // etc.

Make sure to tick the option to commit the selected value of the drop-down field immediately (under Properties - Options) for it to update the other fields as soon as a selection is made.

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 ,
Sep 12, 2018 Sep 12, 2018

Copy link to clipboard

Copied

Thank you for you're reply. I copied and pasted the script you sent me and changed the info to mine but I'm still doing something wrong. I have the addresses in a dropdown box, and the phone and fax numbers in their own text boxes for 3 total boxes. Is this correct? Here is a screen shot of what I'm looking at.

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 ,
Sep 12, 2018 Sep 12, 2018

Copy link to clipboard

Copied

Remove the line numbers from the code. They should not have been a part of it if you copied it from the website.

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 ,
Sep 12, 2018 Sep 12, 2018

Copy link to clipboard

Copied

LATEST

You are AWESOME!!!!!! Thank you so much! That did it.

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