Skip to main content
Participant
May 30, 2018
Answered

Populate text field from drop down box

  • May 30, 2018
  • 1 reply
  • 16199 views

Gday,

I am creating a new form using Acrobat Pro DC (Version 2015.006.30119) and i want to select a name from a dropdown box i have created and have it pre-populate a text field to show their phone number so the user doesnt have to look it up or enter it manually.

Can someone please help me with this? Please note i do not speak code so if you can provide dumb down steps its much appreciated.

This topic has been closed for replies.
Correct answer try67

This requires using a script.

The easiest way to set it up is to add the phone number as the export value of each of the items in your drop-down.

If you do that the only thing you'll need is to enter the following code as the custom calculation script of the text field:

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

I'm assuming above that the drop-down is called "Name".

You might also want to tick the option to commit the selected value of the drop-down immediately. You'll find that under its Properties, Options tab.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 30, 2018

This requires using a script.

The easiest way to set it up is to add the phone number as the export value of each of the items in your drop-down.

If you do that the only thing you'll need is to enter the following code as the custom calculation script of the text field:

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

I'm assuming above that the drop-down is called "Name".

You might also want to tick the option to commit the selected value of the drop-down immediately. You'll find that under its Properties, Options tab.

AlaskanCryptologist
Participating Frequently
August 17, 2021

Has something changed with Adobe where this won't work anymore.  I have tried so many times to get this to work and it doesn't populate the Text Field with the requested value.  I have tried different field names and no go.  I have been playing with Adobe for so long I am getting so tired of it not working.

AlaskanCryptologist
Participating Frequently
August 17, 2021

No, not really. Could you share the file in question where it's not working?


I have tried several different options from different adobe commuity people and none seem to work.  To give you a heads up I start in Microsoft Word creating form and then convert to adobe pdf where I then go into Adobe Acrobat DC.  I prepare form and add fields.  In the DROPDOWN TEST below I enter into dropdown field {Calculate} with:

 

var f = this.getField("Text"); //change text field name as needed
var v = event.value;
f.value = v;

 

And it doesn't prepopulate the Text field.

I have used different coding from the different employees and can't get it to work.  I'm sure its how I am doing it or not doing it.  Adobe has been very frustrating for me.  Thanks of looking into it.