Problems getting selected values from HtmlSelectManyCheckbox
Hello,
I am having problems getting values via getSelectedValues() from my HtmlSelectManyCheckbox component. The method returns an object array but the values are the same as the initial selectItems property.
JSP:
<h:selectManyCheckbox id="checkBox"
binding="#{userEditBean.manyCheckbox}"
value="#{userEditBean.groupIds}"
layout="pageDirection">
<f:selectItems value="#{userEditBean.allGroups}"/>
</h:selectManyCheckbox>
<h:commandButton action="#{userEditBean.ok}"value="OK"/>
Bean:
publicclass UserEditBeanextends BaseBean{
private HtmlSelectManyCheckbox manyCheckbox =new HtmlSelectManyCheckbox();
private String[] groupIds={};
private List allGroups =new ArrayList();
public String[] getGroupIds(){
groupIds= backing.getSomeIds();
return groupIds;
}
}
publicvoid setGroupIds(String[] ids){
this.groupIds= ids;
}
public HtmlSelectManyCheckbox getManyCheckbox(){
return manyCheckbox;
}
publicvoid setManyCheckbox(HtmlSelectManyCheckbox newC){
this.manyCheckbox = newC;
}
public List getAllGroups(){
allGroups = backing.getAllGroups();
return allGroups;
}
publicvoid setAllGroups(List newList){
this.allGroups = newList;
}
public String ok(){
Object o = manyCheckbox.getSelectedValues();
}
The problem is, the getSelectedValues() returns the values from the initial state of the page. The is no mark of the changes made by the user. Any help will be appreciated
Thanks,
Matek

