Skip to main content
Participant
January 3, 2019
Answered

Add dropdown selection to list box items

  • January 3, 2019
  • 3 replies
  • 691 views

Hello,

Here's what I'm trying to do:

Selecting the item# from a dropdown generates a list of ingredients for that item in another dropdown. The selected ingredient from the "Ingredient" dropdown will then be added to the "Order" list box. The goal is to be able to select ingredients in the order they were used. I'm close, I've got the code pretty much worked out.

Here's my code:

For "Item" drop down custom validation script to "Ingredient" list box-

switch (event.value) {

    case " ":

        this.getField("Ingredient").setItems([" "]);

        break;

    case "Item1":

        this.getField("Ingredient").addItems(["ing1","ing2"]);

        break;

    case "Item2":

        this.getField("Ingredient").addItems(["ing3","ing2"]);

        break;

}

The issue is "ing1" is being automatically selected and transferred to the "Order" list and I want to have to select each one manually.

Thank you in advance for the assistance!

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer try67

That's how it works. The first item in the list is the default item.

3 replies

Participant
January 3, 2019

Oh right, thank you. The issue of the first item being automatically selected remains however.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 3, 2019

That's how it works. The first item in the list is the default item.

try67
Community Expert
Community Expert
January 3, 2019

There's no such method called "addItems". Use setItems.