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

Link dropdown choice to autofill a second field

Explorer ,
Apr 07, 2015 Apr 07, 2015

Copy link to clipboard

Copied

I have a dropdown field that allows me to select a variety of vendors.  Is there a way to 'link' these vendor names in the dropdown to associated contact info?  I would like to be able to select one of the vendors in the dropdown, and then have that choice trigger the autofill of a second field with contact info (address, phone, fax) related to that specific vendor.

Is this possible

TOPICS
PDF forms

Views

42.1K

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
1 ACCEPTED SOLUTION
LEGEND ,
Apr 07, 2015 Apr 07, 2015

Copy link to clipboard

Copied

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 ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

Any error in the Javascript console?

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 ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

I just looked at the debugger and got this.Untitled.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 ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

It can't find a entry for cDeptName.

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 ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

In the item list of dropdown field did you name it right (HEADQUARTERS)?

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 ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

Yes, in the drop down field (end user) has HEADQUARTERS as well.

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 ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

It doesn't look like there are any errors in your code. So there must be an issue with matching the dropdown selection to the DeptData. The item names in the dropdown must match the names in DeptData exactly. Including the case. Also make sure there are no spaces in the dropdown item. 

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
New Here ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

I have other drop down selections that has spaces and they match (populate) the address for 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
Community Expert ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

Not spaces as part of the item value, It's spaces on the front and back that are not meant to be part of the value that can make a difference.

 

The error reported in the console shows that the selection in the dropdown does not match the name in the DeptData. So there is some difference. I just mentioned spaces because they can cause a mismatch, but are hard to spot.   

If the difference in the values between the selection and the DeptData is not easy to spot. Then I would suggest adding this line to the top of the "SetFieldValues()" function.

 

console.println("Dept:" + cDeptName + ":");

 

This code will show the selections in the console. 

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
New Here ,
Oct 27, 2020 Oct 27, 2020

Copy link to clipboard

Copied

THANK YOU SO MUCH!! After sleeping on it last night and coming back to it. I checked the drop down and it DID have a space after the S. So adding a space after the S in the code made it work!! Good grief, how I hate codes lol. Thank you for all that has commented and helped. 

 

Is there a way to edit the drop down list after testing it? The fields seems to be uneditable once you close out of building the form.

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 ,
Oct 27, 2020 Oct 27, 2020

Copy link to clipboard

Copied

You can change the fields at Tools > Prepare Form

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 ,
Oct 27, 2020 Oct 27, 2020

Copy link to clipboard

Copied

OMG I wish I asked this way sooner!! I've been recreating everytime there was a change that was needed!! You all have been a life saver!! Thank you SO MUCH!

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 ,
Oct 27, 2023 Oct 27, 2023

Copy link to clipboard

Copied

LATEST

Can you paste the final code?

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 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

I would like to know how to link 12345 in 1st dropdown list with Joe Bloggs in 2nd drop down list please.

 

Should they be drop down lists in the first instance or something else?

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 ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

That's too many entries for a list. And you need to explain the exact behavior that needs to happen on the form. I'd suggest creating  a new topic. 

 

 

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