Skip to main content
Known Participant
August 8, 2018
질문

How do I select an item in a drop-down list and the result displayed in a text field?

  • August 8, 2018
  • 2 답변들
  • 809 조회

Expensive, good afternoon.

I am creating a material request form with 08 columns and 10 rows. The first column refers to the materials, where I created a drop-down list with 534 lists. Each item has a code. I want to click on an item in the drop-down list and the code for this item appears in the second column in a text field. How to do this? And getting, I want to repeat this dropdown list and text field in the 10 lines. it's possible?

  Hugs, Berg

이 주제는 답변이 닫혔습니다.

2 답변

Inspiring
August 8, 2018

You will be using custom JavaScript code for this, so field naming can make this task easier or harder.

For on row. Assuming the drop down field is maned "Item" and the text field is named "Code". for the Action "On Blur" add the following JavaScript:

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

One can also have the code change as one moves up or down the list of items. Set the option for the dropd own to "Commit selected value immediately". Then add the following cod to the "Custom keystroke":

if(event.willCommit != true) {

this.getField("Code").value = event.changeEx;

}

Thom Parker
Community Expert
Community Expert
August 8, 2018
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
BergLino작성자
Known Participant
August 8, 2018

To access the files and tutorials of PDFScripting.com, only if it is a member?

How do I access these files if I am a member of the site?

Thom Parker
Community Expert
Community Expert
August 8, 2018

Most of the detailed scripts, videos, tools, sample files, etc. are for members only. But all the basic info about each topic is free. In fact, the list handling page linked provides quite a bit of material, including the answer to your questions, which is that the field value of the list is the export value of the selected item. So just add this to the format or validate script of the dropdown.

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

Where "TextField" is the field you want the value displayed in.

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