myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Obster <>
Subject Re: Validation errors when using h:selectManyCheckbox
Date Wed, 13 Jun 2007 11:00:34 GMT
Hi Andrew and list,

I've written a converter which converts ArticleGroup into a string and 
backwards. The ArticleGroup has 3 attribute id(long), 
description(String) and active(boolean). Converting in both directions 
are running. The resulting string looks like "1;ASAP PC;true".

Using Strings in the SelectItem works, but when I use ArticcleGroup as 
object, I'm getting a validation error: value is not valid option.

Can you tell me what's wrong, because strings are not as beautiful as 
using the objects in a more direct way.


Andrew Robinson schrieb:
> You need a converter for ActicleGroup. All values from the browser are
> strings and without a converter, none of the string values will ever
> equal one of your ArticleGroup objects, and thus validation fails as
> the user submitted a value that isn't a value select item value.
> If you don't want a converter, you need to make sure the value in the
> select item is a string.
> On 6/12/07, Michael Obster <> wrote:
>> Hi,
>> hope that somebody can help.
>> Trying to get h:selectManyCheckbox running since about 6 hours, but I
>> always get a validation error when I select one of the checkboxes (I
>> cannot give here more info, because I have no, JBoss-Log doesn't say
>> anything, only in the messages I get the validation error) even I'm not
>> using any validator in this JSP :-(.
>> Using in the JSP:
>> <t:selectManyCheckbox value="#{order.selectedArticleGroups}"
>> layout="pageDirection">
>> <f:selectItems value="#{order.articleGroups}" />
>> </t:selectManyCheckbox>
>> The order bean has two ArrayLists:
>> List<ArticleGroup> selectedArticleGroups = new ArrayList<ArticleGroup>();
>> and
>> List<SelectItem> articleGroups = new ArrayList<SelectItem>();
>> The articleGroups are generated by reading a List<ArticleGroup> from the
>> business logic and copy them into the articleGroups-list:
>> List<ArticleGroup> articleList = buyingLogic.getActiveArticleGroups();
>> for (ArticleGroup ag : articleList) {
>>    articleGroup.add(new SelectItem(ag, ag.getDescription));
>> }
>> What's wrong in my understanding of this JSF tag? It's frustrating to
>> get this not running and the only thing Javadoc on MyFaces site says is
>> nothing about what a SelectItem is and for example the params are used
>> for :-(...
>> And it is more and more difficult to convience my colleague here,
>> because he is a fan of struts which I don't like ;-).
>> Any help qould be good!
>> Cheers,
>> Michael

View raw message