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("gwGrpDesc", new > PropertyModel(item.getModel(), "Description"))); > item.add(new Label("gwGrpId", 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]