getting all values of a combobox

hi

Im writing a SMS portlet using vaadim - the user can add phonenumbers meaning im using:

    select.setNewItemsAllowed(true);

and when every time he presses the submit/send sms button I want to store all values in the combobox. I know I can look at the current selected and check if its one I have already stored or assume its new and then add to the prev seen and store all, but I would prefere to do something like

Select s = get-the-select-from-form
List l = s.getItemsInTheSelect();

The first I know, the 2. I dont. I have tried getting all sorts of collections and containers but it seams I just dont understand the underlying model :slight_smile:

So, basicly, if I have a select/combo and added items (by user entering in UI or in code), how can I after get the list?

Example

s = new Select();
s.addItem(“100”);
s.addItem(“200”);

what would be the correct code for:

s = form.getSelect(); //this I know

Collection items = s.getItems();

and items would then contain “100” and “200”?

In this case when you are calling Select.addItem(“100”) you are actually adding an Item to AbstractSelect’s underlying default container. The provided value is then used as an item id. Calling getItemIds() will return all the item ids and in this case the actual values you are inserting.

ah :smiley: was using them as IDs to collections and all other things than just simply trying to see if they are the actual values :slight_smile:

your simple solution ofcause simply works, thanks.