Copy link to clipboard
Copied
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!!
Copy link to clipboard
Copied
The same process should also work for dropdown controls. What is not working? Are you getting any error messages on the JavaScript console?
Copy link to clipboard
Copied
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??
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
}
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now