Skip to main content
Participating Frequently
April 11, 2018
Answered

Populating text from dropdown menu

  • April 11, 2018
  • 2 replies
  • 1795 views

I have a dropdown menu, that when an item is selected a description appears in a text box from the selection in the dropdown list. This is the script I already have, but it only shows for the first item in the dropdown list. I need help getting the text field to show from every selection in my dropdown list.

var v = event.value;

var targetValue = "";

if (v == "Appliance Repair")'

{

     targetValue = "Text";

}

else if (v == "Carpet Repair")

{

     targetValue = "Text2";

}

this.getField("Description").value = targetValue;

This topic has been closed for replies.
Correct answer try67

Check the facility request dropdown and it is under the calculated tab. you may have to move the dropdown boxes from over top of each other so that you can essentially check the dropdown properties.


You had a bunch of issues with conflicting scripts in multiple fields. I fixed it for you in the attached file:

Test Document_edited.pdf - Google Drive

You should study the code and where it's placed, for future reference.

2 replies

Participating Frequently
April 12, 2018

Adobe acrobat XI pro doesn’t show it. So are you saying a person must own a subscription to adobe pro DC?

Thom Parker
Community Expert
Community Expert
April 12, 2018

No, all they need is the Free Acrobat Reader.

But if you want to add an explicit calendar popup to your form, there is a free one here:

Free Sample PDF Files with scripts

However, this is from back in the pre-DC days.  Now that there is an automatic calendar popup, you'll need to add code to test the user's version before displaying it to prevent a conflict.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
April 11, 2018

Where did you place this code?

Participating Frequently
April 11, 2018

I have this code under calculate section, custom script.

try67
Community Expert
Community Expert
April 11, 2018

It should be used as the custom validation script of the drop-down field.