3

I have a <lightning-combo-box> component.

The component shows the default values that I define and lists all of the options that I have given it.

The issue is, when selecting an option from the list, the value of the combo box is set to "please select an option" and none of the options are selectable.

The options are defined as:

@track options = [
    {Label:'Arizona', value:0},
    {Label:'Texas', value:1}
];

1 Answer 1

4

Apparently the value attribute of an option cannot be an integer. Changing the data to show like below works:

@track options = [
    {Label:'Arizona', value:'Arizona'},
    {Label:'Texas', value:'Texas'}
];
2
  • I just ran into this and spent about 2 hours troubleshooting - do we know why the value cannot be a number? Is there any documentation on this?
    – jbyrd
    Jan 25, 2022 at 17:03
  • I'm sorry I do not know why and I don't remember any documentation, unfortunately, it's been nearly 3 years since I've run into the issue. Interesting to see that it's still an issue though.
    – gNerb
    Jan 28, 2022 at 19:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .