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

114

Likes

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

Most Valuable Participant , 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.

Likes

Translate

Translate
Most Valuable Participant ,
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.

Likes

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.

Likes

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