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

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

Participant ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript , Windows

Views

504

Translate

Translate

Report

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 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

Here are some articles that cover the details of scripting lists, and they have sample files.

https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm

https://acrobatusers.com/tutorials/list_and_combo_in_lc

https://acrobatusers.com/tutorials/change_another_field

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

Votes

Translate

Translate

Report

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
Participant ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

LATEST

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 08, 2018 Aug 08, 2018

Copy link to clipboard

Copied

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;

}

Votes

Translate

Translate

Report

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