Skip to main content
Participant
December 14, 2018
Answered

Auto fill 2 text fields depending on export values from a drop down

  • December 14, 2018
  • 2 replies
  • 2048 views

Hi all,

I need to make a change to my current PDF form. In my old form one text field would auto complete depending on the export value of a drop down menu. I did this with a very simple script used as a custom calculation on the text field: 

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

I would set the export value of each option in the drop down as the value that would be displayed in the text field. I now need two text fields to auto fill depending on the option in the drop down. I'm not very familiar with script and some help would be greatly appreciated.  

Correct answer try67

Then you would need to use a conditional script, like this:

var v = this.getField("Dropdown1").valueAsString;

if (v=="1") event.value = "A";

else event.value = ""; // ?? Or maybe something else...

2 replies

Participant
June 2, 2025

Did you ever figure this out? Im doing the same.  I have a list if names in a drop down. I hv set the options to export a number specific to a name. I created text field 1 that auto fills per that export value. I have now added a second text box and would like it to auto fill a title based on a name frm the drop down.  But i cant seem to get 2 export values from the drop down.  Help!

try67
Community Expert
Community Expert
December 14, 2018

Just copy and paste the first field.

The WaughAuthor
Participant
December 14, 2018

Sorry I should have added the values in each of the text boxes needs to be different. i.e if the drop down =1 then text box 1 = A and text box 2 = B

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 14, 2018

Then you would need to use a conditional script, like this:

var v = this.getField("Dropdown1").valueAsString;

if (v=="1") event.value = "A";

else event.value = ""; // ?? Or maybe something else...