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

Adobe Pro DC script for copying data from one dropdown menu to another

Community Beginner ,
Jan 05, 2017 Jan 05, 2017

I have a fillable form that I've made for our sales team to use on sales calls. There are about 20 different fields per row in which they must either fill in data or choose an option from a dropdown menu. I've added a check box beside all of the rows except the first row that the user can check if they simply want to repeat the entire row of entries above. If they uncheck the box, the copied data is cleared from that row.

The script that I've added to the box works for the form fields, but not the dropdowns. Can anyone help me figure out the script that I need to add/revise in order for the check box to work for the entire row above, including the dropdowns? Here is the script that is working for the form fields:

this.getField("Location2").value  = ""

if (this.getField('copy').value == 'Yes') {

this.getField("Location2").value =  this.getField("Location1").value

}

this.getField("Qty2").value  = ""

if (this.getField('copy').value == 'Yes') {

this.getField("Qty2").value =  this.getField("Qty1").value

}

this.getField("Type2").value  = ""

if (this.getField('copy').value == 'Yes') {

this.getField("Type2").value =  this.getField("Type1").value

}

this.getField("Size2").value  = ""

if (this.getField('copy').value == 'Yes') {

this.getField("Size2").value =  this.getField("Size1").value

}

Thank you for any help!!

TOPICS
Acrobat SDK and JavaScript , Windows
1.1K
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 ,
Jan 05, 2017 Jan 05, 2017

The same process should also work for dropdown controls. What is not working? Are you getting any error messages on the JavaScript console?

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 ,
Jan 05, 2017 Jan 05, 2017

I am not getting an error message...I'm wondering if it's not working because the dropdown selection that I need to copy to the next line will actually be copied to another dropdown list??

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 ,
Jan 05, 2017 Jan 05, 2017

Again, it should work. Try this: Create a completely new document and add two dropdown controls (Dropdown1 and Dropdown2) and make sure that both have the same list of options (e.g. "one", "two", "three" and "four"). Then add a button and use this script:

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

When you make a selection in the first dropdown and then click on the button, the selection will be copied to the second dropdown menu. If it's not working in your form, then there must be something else wrong. It could for example be the calculation order.

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 ,
Jan 05, 2017 Jan 05, 2017

That worked great. Thank you. Here's the issue. With the other script, when the check box is unchecked by the user, the fields in that row all clear, but when I apply your script above to my script that does seem to work with non-dropdown fields, it no longer works at all. I can't figure out what I'm missing! ("Thickness" is the first dropdown in the row that I need to be able to copy. "Copy" is the name of the check box.)

this.getField("Thickness2").value  = ""

if (this.getField('copy').value == 'Yes') {

this.getField("Thickness2").value =  this.getField("Thickness1").value

}

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 ,
Jan 05, 2017 Jan 05, 2017

I think this might be occurring because of the this.getField("Thickness2").value - "" portion of the script....I bet I can't use "" with regard to a dropdown, can I?

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 ,
Jan 05, 2017 Jan 05, 2017

Yep...that appears to be it. Initially, the dropdown menu only had 2 items with no blank line allowing for the user to enter custom text. When I went back into the menu and clicked "allow user to enter custom text," I was able to to use my code above to copy the dropdown selection.

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 ,
Jan 05, 2017 Jan 05, 2017
LATEST

Oddly, however, several other dropdowns are indeed allowing me to copy the selection even though I did NOT check the "allow custom text" option.

So sorry for the string of comments here!

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