leon
leon

Reputation: 3

How do you get the selected items in a Wicket ListMultipleChoice?

I'm using a ListMultipleChoice component in wicket and I want to get the selected items. It seems that isSelected is protected so I cannot use it. How do I get the selected items?

Upvotes: 0

Views: 2782

Answers (1)

leonidv
leonidv

Reputation: 1412

You must bind your list with data and ListMultipleChoice as in Example

public MyForm(String id, IModel model, IFeedback feedback) {
    List choices = new ArrayList();
    choices.add("foo");
    choices.add("bar");
    MultiListChoice lc = new MultiListChoice("myMultiListChoice", new PropertyModel(model, "foobarList"), choices);
    add(lc);
    ...
}

Upvotes: 3

Related Questions