Skip to main content
New Participant
April 4, 2023
Answered

Auto Populate Text When Drop Down Selection Is Made

  • April 4, 2023
  • 2 replies
  • 7868 views

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!

This topic has been closed for replies.
Correct answer Nesa Nurani

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".

2 replies

New Participant
February 29, 2024

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.

Nesa Nurani
Community Expert
March 1, 2024

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

New Participant
March 5, 2024

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.

Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
April 4, 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 owner you would like to show in "Application Owner".

New Participant
April 4, 2023

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"

Nesa Nurani
Community Expert
April 4, 2023

It looks ok, did you set export values in dropdown field?