Hey All,

I noticed that "setRequired(true)" on ListMultipleChoice does not have an
effect anymore after upgrading to Wicket 6 from Wicket 1.5.7.

I think it might be a problem with the ajax library because the AJAX post
request looks like this (where 'tags' is my <select multiple /> field)

tags:null
> :submit:1


The ListMultipleChoice now thinks that the input was non-empty (String
'null') and returns an empty list when converting the value and hence
passes the required check because an empty list is non-null.

@Override
protected Collection<T> convertValue(String[] ids) throws
ConversionException
{
if (ids != null && ids.length > 0 && !Strings.isEmpty(ids[0]))
{
return convertChoiceIdsToChoices(ids);
}
else
{
ArrayList<T> result = new ArrayList<T>();
addRetainedDisabled(result);
return result;
}
}

When I change the component to a simple DropDownChoice the request looks
like this and everything works as expected:


> tags:
> :submit:1


Cheers,

Thomas

Reply via email to