a4j:support selectOneRadio rerendering not working
nschweig Dec 17, 2008 5:57 AMHi,
I want to use a <h:selectOneRadio> with a4j:support. If the value changes in the selectOneRadio, the <h:listbox id="groups...> should be rerendered.
<h:selectOneRadio layout="pagedirection" value="#{appointmentBean.appointmentType}">
<f:selectItem itemValue="#{appointmentBean.appointmentType_general}" itemLabel="fuer alle verfuegbar" />
<f:selectItem itemValue="#{appointmentBean.appointmentType_group}" itemLabel="fuer Gruppe verfuegbar"/>
<a4j:support event="onchange" reRender="groups" />
</h:selectOneRadio>
<h:selectOneListbox value="#{appointmentBean.relatedGroupId}" id="groups" rendered="#{appointmentBean.appointmentType_group}">
<f:selectItems value="#{groupBean.allGroupsAsItems}"/>
</h:selectOneListbox>If the value of the radiobutton is
appointmentType_generalthe listbox should not be rendered because there is a rendering condition:
<h:selectOneListbox value="#{appointmentBean.relatedGroupId}" id="groups" rendered="#{appointmentBean.appointmentType_group}">My first problem is that if I invoke the page at the first time, the selectOneRadio-Boxes are both unselected.
But in my bean I initialized the values:
... ...appointmentType_general=true; ...appointmentType_group=false; ...
The second problem is that if I change the value in the selectOneRadio the ajax request is fired. I can see in the debugger that in my bean the isAppointmentType_group() method is invoked and the values are set right. But on the page the listbox is not rendered.
Here is my beancode:
...
public void setAppointmentType(String appointmentType) {
if(appointmentType.equals("appointmentType_general")){
this.appointmentType_general=true;
this.appointmentType_group=false;
}
else{
this.appointmentType_general=false;
this.appointmentType_group=true;
}
}
public boolean isAppointmentType_general() {
return appointmentType_general;
}
public void setAppointmentType_general(boolean appointmentType_general) {
this.appointmentType_general = appointmentType_general;
}
public boolean isAppointmentType_group() {
return appointmentType_group;
}
public void setAppointmentType_group(boolean appointmentType_group) {
this.appointmentType_group = appointmentType_group;
}
...Any ideas?
Thanks, Nicki