Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

populating drop down boxes with default values

brad.bylls
Collaborator
Collaborator

populating drop down boxes with default values

brad.bylls
Collaborator
Collaborator

I am working on an api UI that has six drop down boxes.

What I am trying to do is when the user selects an item from the first drop down box, (which gathers data from a csv file) the other dropdown boxes are populated with a default value, but are still able select a different value from the dropdown list.

I have been working a couple of days on this and just can't figure it out. I'm sure it is pretty simple, but . . .

The complete code is attached.

Any help appreciated.

Thank you.

ps. I know the code is a little sloppy, but I want to get it to work first.

Brad Bylls
0 Likes
Reply
Accepted solutions (1)
277 Views
1 Reply
Reply (1)

OceanHydroAU
Collaborator
Collaborator
Accepted solution

This fragment of code from one of my projects might help?

 

if cmdh[v]['type']=='RadioButtonGroupCommandInput' or cmdh[v]['type']=='ButtonRowCommandInput' or cmdh[v]['type']=='DropDownCommandInput': # button / Dropdown
    if cmdh[v]['type']=='DropDownCommandInput' and dlg[v].selectedItem is None:
        dlg[v].listItems.add(" ",True)  # Need to first create the selected object before we can select a different one
    if dlg[v].selectedItem.index >= 0:
        dlg[v].listItems[ dlg[v].selectedItem.index ].isSelected=False # Un select previous
    dlg[v].listItems[setting].isSelected=True # Select preset

 

That demo's adding/populating, as well as selecting stuff

0 Likes