How do I make a dropdown field auto populate two other fields?

New Here ,
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

124

Likes

Translate

Translate

Report

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

1 Correct Answer

Most Valuable Participant , Sep 12, 2018
try67 Most Valuable Participant , 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.

Likes

Translate

Translate
Jump to answer Jump to answer
Most Valuable Participant ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Erik52 AUTHOR
New Here ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Erik52 AUTHOR LATEST
New Here ,
Sep 12, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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