Hi!
I use the Tomahawk selectManyCheckbox with f:selectItems bound to a LinkedList of SelectItem instances. This instances have a java.lang.String as label and a java.lang.Character as value. For the value-binding of the selectManyCheckbox, I tried to use a LinkedList instead of an Object or primitive array because I think the selected options can be processed more easily by iterating over a list. To set the currently selected values of the selectManyCheckbox, I filled the related LinkedList by iterating over the f:selectItems LinkedList. > If the value binding is a List, then the myfaces assumes (per the spec) > that all elements are of type String, not the same type as > SelectItem.getValue(). I tried both, using SelectItem.getValue() and SelectItem.getValue().toString(), and both worked to set the currently selected values. But when I tried to submit the page, I got a validation error saying the values are no valid options, with both variants described before. I found the following blog entry referring to the same validation error issue (see June 18, 2004): http://jroller.com/page/nuprn1/20040722 Or see also: http://www.crazysquirrel.com/computing/java/jsf/select-many.jspx Does anyone of you know of a working solution using a List as value-binding of the selectManyCheckbox component? Or can you confirm that using a List is not possible? Are there any official statements? I searched the Issue Tracking database of MyFaces (http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10600) and SUN JSF RI (https://javaserverfaces.dev.java.net/) but didn't find any issues regarding the List value-binding problem. Regards, Matthias > -----Ursprüngliche Nachricht----- > Von: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Auftrag > von Dave Brondsema > Gesendet: Mittwoch, 4. Januar 2006 15:01 > An: MyFaces Discussion > Betreff: Re: What Object Type for SelectManyCheckbox > > > Simon Kitching wrote: > > On Mon, 2006-01-02 at 18:00 +0100, [EMAIL PROTECTED] wrote: > > > >>Hi all! > >> > >>I'm just trying the SelectManyCheckbox component. What is the best > >>Object type the value of the SelectManyCheckbox should point to? > >> > >>Should I take a List or a Long[] or a Object[]? What should be > >>newPartnerDto.datenarten? > >>And how can I retrieve the selected items in my backing bean? > >> > >> > >><h:selectManyCheckbox id="Datenarten" required="true" > >>value="#{newPartnerDto.datenarten}"> > >> <f:selectItems value="#{queryHelper.datenartContact}"/> > >></h:selectManyCheckbox> > > > > > > Hopefully the improved taglib documentation in the current MyFaces TRUNK > > makes this clear. Search this file for "selectManyCheckbox": > > > http://svn.apache.org/repos/asf/myfaces/impl/trunk/src/main/tld/my > faces_html.tld > > > > If the docs still aren't clear enough, please let me know. > > > > If the value binding is a List, then the myfaces assumes (per the spec) > that all elements are of type String, not the same type as > SelectItem.getValue(). > > That should be made clear and since using a List does work unintuitively > like that, I'd suggest listing it last, after "Object array or primitive > array" > > > -- > Dave Brondsema > Software Developer > Cornerstone University >

