Skip to main content
Ryan_Oliver_02445
Known Participant
January 30, 2019
Answered

How to select values in a Drop down box within JS

  • January 30, 2019
  • 1 reply
  • 676 views

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!

This topic has been closed for replies.
Correct answer try67

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.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 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.

Ryan_Oliver_02445
Known Participant
January 30, 2019

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.