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

Populate text field from drop down box

New Here ,
May 29, 2018 May 29, 2018

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.

TOPICS
PDF forms
15.3K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
May 30, 2018 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.

View solution in original post

Translate
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 ,
May 30, 2018 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.

Translate
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 ,
Oct 25, 2018 Oct 25, 2018

Hi,

I am having a similar issue, but I am not able to set the export values of the dropdown as the values in the dropdown are dependent on the selections from another dropdown. Is there a way I can add to the below, but have it run an IF statement of some sort to tell it to output a number when a name is populated?

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

Thank you!

Translate
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 Beginner ,
Aug 17, 2021 Aug 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.

Translate
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 ,
Aug 17, 2021 Aug 17, 2021

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

Translate
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 Beginner ,
Aug 17, 2021 Aug 17, 2021

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.

Translate
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 Beginner ,
Aug 17, 2021 Aug 17, 2021

Oh when showing my process after enter all my fields I then convert to Adobe Sign.

Translate
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 ,
Aug 17, 2021 Aug 17, 2021

You can either have scripts, or you can have an Adobe Sign form, but not both.

Translate
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 ,
Aug 17, 2021 Aug 17, 2021

First step would be to revert it to an Acrobat form.

Translate
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 Beginner ,
Aug 17, 2021 Aug 17, 2021

Sorry, here you go.

Translate
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 Beginner ,
Aug 17, 2021 Aug 17, 2021

I missed one of your responses.  You mentioned I can either have scripts, or you can have an Adobe Sign form, but not both.  Well I use adobe sign forms to send out different forms.  Through Adobe Acrobat DC can I send several forms "together" so that I can use the scripts option?  Or is there something I have to do in Adobe Sign to get the scripting idea, or outcome, I want to accomplish?

Translate
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 ,
Aug 18, 2021 Aug 18, 2021

You can use Acrobat's Distribute command to do it, or simply attach the file to an email and send it to the recipients. You can add to it a button so that it can be submitted back to you, when filled in.

If you want the users to sign it, add a (required) digital signature field.

Translate
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 Beginner ,
Aug 18, 2021 Aug 18, 2021

Thank you Try67 I will give that a try.

Translate
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 Beginner ,
Aug 18, 2021 Aug 18, 2021

Try67 I was able to send a form and the dropdown populated the text field as asked which is awesome.  I haven't tried sending any combined forms though.  I will.

But I just don't like how it all goes and the professionalism about it being "Adobe" and all.  I wanted to do this all through Adobe Sign which I why I pay for it.  I just find it hard to understand that Adobe Sign can't seem to do what I am asking.

 

Thanks for the help Try67.  

Translate
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 ,
Sep 15, 2021 Sep 15, 2021

@try67 

Hi!  I am working on a form that on the first page has a dropdown with three options, and depending on the selected option, I want to code the form to pre-populate information on the third page of the form. The information will vary depending on the selected option, and should be pre-populated into eight different fields.  The code that I have is this:

 

var v = this.getField("Campus").value

 

if (v == " A")

{

getField("PTELegalAddress").value = "University sample\nDepartment Sample\nStreet sample\nState sample";

getField("PTECentralEmail").value = "abc@university.edu";

getField("PTEACName").value = "Name sample";

getField("[PTEACPhone").value = "phone sample";

getField("PTEAOName").value = "fixed value sample";

getField("PTEAOEmail").value = "email sample ";

getField("PTEAOPhone").value = "phone sample";

getField("PTEInvoiceAdress").value = " University sample\nDepartment Sample\nStreet sample\nState sample ";

this.getField("PTELegalAddress").display = display.visible;

this.getField("PTECentralEmail").display = display.visible;

this.getField("PTEACName").display = display.visible;

this.getField("PTEACPhone").display = display.visible;

this.getField("PTEAOName").display = display.visible;

this.getField("PTEAOEmail").display = display.visible;

this.getField("PTEAOPhone").display = display.visible;

this.getField("PTEInvoiceAddress").display = display.visible;

}

 

I have coded this into a 'run' button, but it is not working. Can you help me, please?

 

Thanks in advance!

Translate
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 ,
Sep 15, 2021 Sep 15, 2021

The code seems fine. Are there any error messages in the JS Console when you use it?

Translate
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 ,
Sep 15, 2021 Sep 15, 2021

none 😞 

 

when I 'click' the button to run the scrip nothing happens on the third tab, and I would expect to see the field pre-populated

 

Translate
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 ,
Sep 15, 2021 Sep 15, 2021

@try67  I found the problem!! it was the 'appearance' of the address field because the code includes new lines and the field was "autofill"

 

oh the joys of coding!

Translate
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 ,
Sep 15, 2021 Sep 15, 2021
LATEST

Not sure what you mean, but glad to hear it's sorted!

Translate
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