Tom Götz

Results 17 comments of Tom Götz

Return an empty list and provide some user feedback using component.error("...")?

Hm, you could do the following: ``` java public class MySelect2Choice extends Select2Choice { public MySelect2Choice(String id, IModel model, ChoiceProvider provider) { super(id, model, provider); } @Override public void onResourceRequested()...

Hmm, let me think about that. @ivaynberg : You have a better idea?

Patches or pull requests are always welcome ;-)

But: can't you provide an (unique) id value for your EmailAddressHolder that enabled reconstruction in toChoices()? Meaning: where do you keep your list of EmailAddressHolders? Wouldn't it be enough to...

So then, why can't you use the list index of your list of holder objects to generate the id? ``` java public abstract class MyChoiceProvider extends TextChoiceProvider { private IModel

Wicket does the same: storing the id of the list index in the client, see `org.apache.wicket.markup.html.form.ChoiceRenderer#getIdValue`. I can't see anything wrong with that approach, what is your concern?

Ok, I see your point. Are the email addresses unique? You could use those as id then.

No problem, simply do something like this: ``` java Select2MultiChoice multiChoice = new Select2MultiChoice( "multiChoice", model, choiceProvider); form.add(multiChoice); multiChoice.add(new AjaxEventBehavior("change") { @Override protected void onEvent(AjaxRequestTarget target) { // do something...