Copy link to clipboard
Copied
I'm adding a combo box to the stage and putting a prompt on it. Once the operation on the stage is complete I'm "clearing" the selections of the user. However I can never get a combo box to clear correctly. I want to just deselect the item that was selected and add the prompt again. Here's how I'm adding it:
my_cb.prompt = "Select...";
my_cb.dataProvider = year_db;
my_cb.setStyle("embedFonts", true);
Now reseting it I've tried everything but this gives me a blank prompt:
my_cb.selectedItem = null;
my_cb.prompt = "Select...";
Thanks
The display of the prompt is dependent on the value of the selectedIndex being -1. To reset the combobox you just need to reset the selected index to -1 and the prompt originally assigned should be restored automatically. You should not need to reassign the prompt unless you are revising what it says.
my_cb.selectedIndex = -1;
I believe it will also work if you use selectedItem instead
Copy link to clipboard
Copied
The display of the prompt is dependent on the value of the selectedIndex being -1. To reset the combobox you just need to reset the selected index to -1 and the prompt originally assigned should be restored automatically. You should not need to reassign the prompt unless you are revising what it says.
my_cb.selectedIndex = -1;
I believe it will also work if you use selectedItem instead
Copy link to clipboard
Copied
Perfect! Very interesting they made it work that way. I like it! thanks for your help.
C
Copy link to clipboard
Copied
You're welcome
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more