You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jeff Palmer <jp...@citytechinc.com> on 2009/04/13 19:24:10 UTC
CheckBoxMultipleChoice Question
I'm trying to use a CheckBoxMultipleChoice component to render all roles that a user currently has and also to allow user roles to be added / deleted. For some reason, the roles that a user has are being rendered on the page correctly, but none of the checkboxes are getting displayed on the page as being checked. Is there something I need to do to get the selected roles to get displayed as checked?
Re: CheckBoxMultipleChoice Question
Posted by Matthew Hanlon <mr...@gmail.com>.
Check and make sure that the model for the CheckBoxMultipleChoice is getting
set properly and the model is loading the data.
I do a similar thing, but with CheckGroup and Check:
Form<User> form = new Form<User>("user-form", new
CompoundPropertyModel<User>(userModel));
add(form);
form.add(new RequiredTextField<String>("firstName"));
form.add(new RequiredTextField<String>("lastName"));
form.add(new RequiredTextField<String>("email"));
form.add(new RequiredTextField<String>("login"));
form.add(new CheckBox("active"));
CheckGroup<Role> roles = new CheckGroup<Role>("roles");
form.add(roles);
roles.add(new ListView<Role>("role-option", new RoleListModel(roleSvc)) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<Role> item) {
item.add(new Label("name", item.getModelObject().getName()));
item.add(new Check<Role>("check", item.getModel()));
}
});
Regards,
Matthew.
On Mon, Apr 13, 2009 at 12:24, Jeff Palmer <jp...@citytechinc.com> wrote:
> I'm trying to use a CheckBoxMultipleChoice component to render all roles
> that a user currently has and also to allow user roles to be added /
> deleted. For some reason, the roles that a user has are being rendered on
> the page correctly, but none of the checkboxes are getting displayed on the
> page as being checked. Is there something I need to do to get the selected
> roles to get displayed as checked?
>
--
Matthew Rollins Hanlon
http://squareoftwo.com
_____________________
Hanlon's Razor:
"Never attribute to malice that which can be adequately explained by
stupidity."
http://wikipedia.org/wiki/Hanlon's_razor