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

Auto Populate Text When Drop Down Selection Is Made

New Here ,
Apr 04, 2023 Apr 04, 2023

Copy link to clipboard

Copied

Hello,

Every formula I have found seems to not be working for this issue. I am trying to auto populate text when a selection is made on a drop down list in Adobe Acrobat Pro. 

Drop down box is labeled "Application" and text field is "Application Owner" when a selection is made under "Application" I want the owner of each application to auto fill in the text field "Application Owner" I have 6 applications to chose from and 5 owners.

 

I'm not sure if this would work better if both boxes were drop downs?

 

Please help!!!

 

Thank you!

TOPICS
How to , JavaScript , PDF forms

Views

2.8K

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 , Apr 04, 2023 Apr 04, 2023

As validate script of dropdown field use this:

var f = this.getField("Application Owner");
if(event.value == "Selection for owner1")
f.value = "Info for owner1";
else if(event.value == "Selection for owner2")
f.value = "Info for owner2";
else if(event.value == "Selection for owner3")
f.value = "Info for owner3";

//add more 'else if' lines here for other choices as needed

else
f.value = "";

Change "Selection for owner" to your actual choices in dropdown and "Info for owner" with info for that o

...

Votes

Translate

Translate
Community Expert ,
Apr 04, 2023 Apr 04, 2023

Copy link to clipboard

Copied

As validate script of dropdown field use this:

var f = this.getField("Application Owner");
if(event.value == "Selection for owner1")
f.value = "Info for owner1";
else if(event.value == "Selection for owner2")
f.value = "Info for owner2";
else if(event.value == "Selection for owner3")
f.value = "Info for owner3";

//add more 'else if' lines here for other choices as needed

else
f.value = "";

Change "Selection for owner" to your actual choices in dropdown and "Info for owner" with info for that owner you would like to show in "Application Owner".

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 04, 2023 Apr 04, 2023

Copy link to clipboard

Copied

Thank you! I'm not sure if I have an error in here but this is the formula I entered (removed names for post) and my text field isn't auto populating with the name..

"Application Owner" is the name of the text box where I want "Owner Name" to appear. I enterned the JavaScript in the drop down properties. Drop down name is "Application".

 

var f = this.getField("Application Owner");
if(event.value == "Application Name")
f.value = "Owner Name";
else if(event.value == "Application Name")
f.value = "Owner Name";
else if(event.value == "Application Name")
f.value = "Owner Name";
else if(event.value == "Application Name")
f.value = "Owner Name"
else if(event.value == "Application Name")
f.value = "Owner Name"
else if(event.value == "Application Name")
f.value = "Owner Name"

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 04, 2023 Apr 04, 2023

Copy link to clipboard

Copied

It looks ok, did you set export values in 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
New Here ,
Apr 04, 2023 Apr 04, 2023

Copy link to clipboard

Copied

Maybe, I'm not sure if I/how to do that. I entered the formula on the drop down. I have attached some screenshots.

 

The formula is in the run JavaScript on the dropdown properties and nothing is entered in the text field box where I want the owner names to appear. 

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 04, 2023 Apr 04, 2023

Copy link to clipboard

Copied

Here is the items in the drop down

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 04, 2023 Apr 04, 2023

Copy link to clipboard

Copied

I figured out where I went wrong. 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 ,
Feb 29, 2024 Feb 29, 2024

Copy link to clipboard

Copied

I have watched your video, which was very helpful, but I'm still unable to have the information autopopulate into my document.  I'm new to javascript,  and might be missing something.  I'm trying to have the Contract Name autopopulate when the Contract No is selected.

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 ,
Feb 29, 2024 Feb 29, 2024

Copy link to clipboard

Copied

Where did you put the script?  Can you share your file?

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 ,
Mar 05, 2024 Mar 05, 2024

Copy link to clipboard

Copied

I'm doing something similar and I really don't get this at all.  This is my first time trying to do anything like this in a PDF.  So, I have a Dropdown called ServiceType and a Text field called ServiceChoice.  I want text to appear in ServiceChoice based on the selection from ServiceType as follows:

 

ServiceType = Gas Service

ServiceChoice = Gas facilities

ServiceType = Electric Service

ServiceChoice = Electric facilities

ServiceType = Gas and Electric Service

ServiceChoice = Gas and Electric facilities

 

Right now I have:

var f = this.getField("ServiceChoice");
if(event.value == "Gas Service")
f.value = "Gas facilities";
else if(event.value == "Electric Service")
f.value = "Electric Facilities";
else if(event.value == "Gas and Electric Service")
f.value = "Gas and Electric Facilities";

 in the Validate Custom Script for my dropdown box.

 

What do I need to do?  Also, I'm on a work computer, so I cannot see attached images or files.

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 ,
Mar 05, 2024 Mar 05, 2024

Copy link to clipboard

Copied

The script looks ok, what happens when you make selection in dropdown?

Check console (CTRL+J) for errors.

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 ,
Mar 05, 2024 Mar 05, 2024

Copy link to clipboard

Copied

I JUST figured it out.  I didn't realize the part about the Export Validation.  I had to look that up separately.

So once I put those in there, it works seamlessly!  🙂

I'm still confused why, but hey, it works.  I now have "Gas Service." as my Item Name and "Gas Service" as the Export Value.  Seeing as my script references the "Gas Service.", I don't know why I need to have the Export Value in there.

 

This is how I have it now.

Robert35875815d2nn_0-1709657863616.png

var f = this.getField("ServiceChoice");
if(event.value == "Gas Service.")
f.value = "Gas facilities";
else if(event.value == "Electric Service.")
f.value = "Electric Facilities";
else if(event.value == "Gas and Electric Service.")
f.value = "Gas and Electric Facilities";

 

 

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 ,
Mar 05, 2024 Mar 05, 2024

Copy link to clipboard

Copied

You don't need export value, but you didn't check right condition in your first script you forgot dot on the end.

You can use export value but like this: 

"Gas Service." export value "Gas facilities"

"Electric Service." export value "Electric Facilities"

"Gas and Electric Service." export value "Gas and Electric Facilities"

then as custom calculation script of dropdown use this:

this.getField("ServiceChoice").value = event.value;

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 ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

swatson98_0-1709820755200.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
New Here ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

This may be a rookie questions, but should the custom calculation script be associated witht he ContractName field or the drop down 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
New Here ,
Mar 07, 2024 Mar 07, 2024

Copy link to clipboard

Copied

LATEST

I found my mistake.  Thank you for your help.

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