issue with modalPanel and selectOneRadio
amcghie Apr 27, 2010 11:29 AMHello everyone,
I'm hoping someone can help me. I have having trouble getting the value of a selectOneRadio component to update with a modalPanel. I have created the following trivial example to demostrate my problem, can anyone see what I'm doing wrong?
I have the following XHTML page:
{code:xml}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
<a4j:form>
<a4j:commandLink id="showModalPanelLink"
value="Show Modal Panel">
<rich:componentControl for="modalPanel" attachTo="showModalPanelLink" operation="show" event="onclick"/>
</a4j:commandLink>
<br/>
<a4j:outputPanel id="status">
<h:outputText value="#{backingBean.mandatory}" />
</a4j:outputPanel>
</a4j:form>
<a4j:form id="modalForm">
<rich:modalPanel id="modalPanel" width="350" height="150">
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Set Mandatory" />
</h:panelGroup>
</f:facet>
<h:panelGrid columns="2">
<h:panelGroup />
<h:selectOneRadio id="mandatoryRadio"
value="#{backingBean.mandatory}">
<f:selectItem itemValue="true" itemLabel="Mandatory" />
<f:selectItem itemValue="false" itemLabel="Optional" />
</h:selectOneRadio>
<h:panelGroup />
<a4j:commandButton id="addButton"
action="#{backingBean.logMandatoryValue}"
value="Hide"
reRender="status"
oncomplete="#{rich:component('modalPanel')}.hide()" />
</h:panelGrid>
</rich:modalPanel>
</a4j:form>
</html>
{code}
and the following in my backing bean (which is declared with session scope):
{code:java}
public class BackingBean {
private boolean mandatory = false;
public backingBean() {}
public String logMandatoryValue() {
System.out.println("Mandatory=" + mandatory);
return null;
}
public boolean getMandatory() {
return isMandatory();
}
public boolean isMandatory() {
return mandatory;
}
public void setMandatory(boolean mandatory) {
this.mandatory = mandatory;
}
}
{code}
No matter which value I select in the modalPanel the value shown is false (in both the browser and log).
Any help would be greatly appreciated
Kind Regards
Andy