Hello every body,
I have got the problem again, I have a form to add new Role which has
name, description and list of permissions. Role name and description are in
text fields and permissions are as checkboxmultiplechoice, I am having
difficult time in getting the values of the checked boxes. How do I get the
list of checked values in onSubmit() method. I tried as in code shown below
but it never returned any checked value
. What should I do ? I studied the examples in wicket component ref and
cwiki examples but could not succeed to solve it.
public void roleAdd() {
List permList = new ArrayList();
Role role = new Role();
CompoundPropertyModel roleAddModel = new
CompoundPropertyModel(role);
final Form form = new RoleAddForm("roleForm",roleAddModel);
add(form);
final TextField roleComp = new TextField("name");
final TextArea desComp = new TextArea("description");
try{
permList = p.list();
}catch(SQLException e){
String err = e.getMessage();
}
permComp = new CheckBoxMultipleChoice("permList",permList);
permComp.setModel(new Model());
form.add(roleComp);
form.add(desComp);
form.add(permComp);
}
class RoleAddForm extends Form{
public RoleAddForm(String id, IModel model){
super(id,model);
}
@Override
public void onSubmit() {
Role newRole = (Role)getModelObject();
Role r = new Role(); // Role to a be added
r.setName(newRole.getName());
r.setDescription(newRole.getDescription());
List perms;
perms = (List) model.getObject(permComp);
....................
....................
}
thanks
--
View this message in context:
http://www.nabble.com/Get-Value-entered-in--CheckBoxMultipleChoice--and-TextFields-tf4896987.html#a14025061
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]