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

How to select values in a Drop down box within JS

Explorer ,
Jan 30, 2019 Jan 30, 2019

Copy link to clipboard

Copied

Good evening, I am attempting to access a drop down list, however,  I can't seem to change the value of the Drop down box within JS.  Here is my code:

       var ListOne = this.getField("relationship.0");

       var search = ListOne.getItemAt[1];

       console.println(search.value);

I can print out the current value that's set in the drop down list, but I can't set it to, "Mother" or, "Brother."

Any help would be greatly appreciated!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

329

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

correct answers 1 Correct answer

Community Expert , Jan 30, 2019 Jan 30, 2019

Your code contains multiple errors, but at any rate you can't set the value of a specific item in the list, only the entire list as a whole, using the setItems method.

Votes

Translate

Translate
Community Expert ,
Jan 30, 2019 Jan 30, 2019

Copy link to clipboard

Copied

Your code contains multiple errors, but at any rate you can't set the value of a specific item in the list, only the entire list as a whole, using the setItems method.

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
Explorer ,
Jan 30, 2019 Jan 30, 2019

Copy link to clipboard

Copied

LATEST

Works grand now, here is an example of the code that works as intended:

var ListOne = this.getField("relationship.0");

ListOne.setItems(["Brother from another Mother"]);

console.println(ListOne.value);

Simple as that, thank you.

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