Sorry if I'm being dense. I'm coming to Wicket from the Struts world. ;) The roles beans in the collection have a Boolean property 'hasRole' which I use to set the checkbox state. It has other properties I use to display the descriptions.
Maybe it will be helpful for me to explain why the rolesGroup object gets passed on when I use Check but not when I use CheckBox. That said, I don't really need to use a CheckGroup, I did that because the list of roles isn't fixed, I need to get the latest set from the database. Would it be easier to just use a series of checkboxes and (if it's not too much trouble) how could I go about that? Thanks Greg -----Original Message----- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Friday, March 14, 2008 10:59 AM To: users@wicket.apache.org Subject: Re: CheckGroup, CheckBox and Check checkgroup's model is the selection mode, so it should be bound to user's assigned roles list, not the list of all available roles. -igor On Fri, Mar 14, 2008 at 7:45 AM, Greg Dunn <[EMAIL PROTECTED]> wrote: > > I've got a collection of beans ("roles") containing user authorization > roles that I'm using as the Model for a ListView. I'm confused by the > interaction between CheckGroups, Check's and CheckBox's. If I use > CheckBox my roles show up selected if the user has the role, but I can't > get the Model Object when I submit. If I use Check the roles the user > has do not show up selected, but I get the Model Object after I submit. > > My code for creating the CheckGroup ListView: > > rolesGroup = new CheckGroup("rolesGroup", roles); > add(rolesGroup); > ListView rolesList = new ListView("roleList", roles) { > protected void populateItem(ListItem item) { > item.add(new CheckBox("roleCheck", new > PropertyModel(item.getModel(), "hasRole"))); > item.add(new Label("description", new > PropertyModel(item.getModel(), "description"))); > item.add(new Label("groupId", new > PropertyModel(item.getModel(), "groupId"))); > }}.setReuseItems(true); > rolesGroup.add(rolesList); > rolesGroup.add(new > CheckGroupSelector("rolesGroupSelector")); > > > And getting the model object in onSubmit(): > > List userRoles = (List) rolesGroup.getModelObject(); > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]