Skip to main content
Known Participant
August 31, 2023
Question

Problem Linking Dropdown Lists and Independent Text Fields

  • August 31, 2023
  • 1 reply
  • 1491 views

 

Description:
Hello members of the Adobe community,

I'm running into a puzzling issue when trying to create independent copies of dropdown lists and text fields in a project. I would like to share my situation and ask for help in finding a solution.

 

Context:
Within my project, I have a dropdown called "EPI DESCRIPTION.0", which contains a variety of Personal Protective Equipment (EPI). When I select a specific item from this drop-down list, I want the text field "CA.0" to auto-populate with the corresponding value of the Certificate of Approval (CA) for that PPE.

To make the process more organized, I created copies of the dropdown lists and text fields, renaming them to "EPI.1 DESCRIPTION" and "CA.1" respectively. The idea is that these copies are independent of the originals.

 

The problem:
However, when selecting an item from the "EPI.1 DESCRIPTION" drop-down list, the resulting value is displayed in the "CA.0" text field instead of appearing in the "CA.1" field. It seems the copies are not working independently as intended.

 

Help Request:
I'm looking for guidance on how to fix this issue and make the copies of dropdowns and text fields truly independent. I need to ensure that when choosing an item from the "EPI.1 DESCRIPTION" list, the associated value is displayed in the "CA.1" field.

 

Thank you in advance for any help, suggestions or solutions you can offer me. Your expertise will be very valuable to resolve this obstacle and move forward with my project.

 

Yours sincerely,
Berg

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
August 31, 2023

The original dropdown field "EPI DESCRIPTION.0" contains a script that populates the "CA.0" field. When you copied the dropdown you also copied this script. Obviosly the script hard codes the destination field name. So you'll need to either modify the script for each different dropdown/text field pair, or write a generic script that  will work for all of them, based on the field names. 

This article explains how to find the scripts on a form field:

https://www.pdfscripting.com/public/Editing-Fields-Properties.cfm

 

Please the code you find, and where you found it. And if posssible,post your form so we can take a look at it. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
BergLinoAuthor
Known Participant
September 1, 2023

Thanks for the information feedback.
I attach the form with the codes in JS for analysis.

Thanks for the help.

Berg

Thom Parker
Community Expert
Community Expert
September 1, 2023

The problem is this document level function

function SetFieldValues(cDeptName) {
  this.getField("CA.0").value = DeptData[cDeptName].contact;
 
}

 

It needs to be modified to change the target field name to match the "CA" field on the same line.

 

BTW: the code on this form looks suspciously like code I've written for other examples. Where did you get it?

    

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often