Hi,
I noticed that a radioGroup returns different values to its server onclick event (onchange seems not to work in IE) when a radio button and a radio label is clicked. In the eventHandler this.getParent().getValue() is the currently selected value when the radio button is clicked, but the previously selected value when the radio itemLabel is clicked.
In the Firebug console I see that the XMLHttpRequest submits the old value when the label is clicked. I also noticed that the radioGroup HTML input elements do not have a client id (even though I have given the selectItems an id) and the label elements do not have a βforβ attribute. I think the label is not properly associated with the field.
| One | Two | Three |
Any ideas how I can get the currently selected value from a radioGroup when one of its labels is clicked?
Example:
<?xml version="1.0" encoding="UTF-8"?><xp:view xmlns:xp=βhttp://www.ibm.com/xsp/coreβ>
<xp:div>
<xp:radioGroup id="field" value="#{sessionScope.field}"
defaultValue="1">
<xp:selectItem itemLabel="One" itemValue="1" id="field1">
</xp:selectItem>
<xp:selectItem itemLabel="Two" itemValue="2" id="field2">
</xp:selectItem>
<xp:selectItem itemLabel="Three" itemValue="3" id="field3">
</xp:selectItem>
<xp:eventHandler event="onclick" submit="true"
refreshMode="norefresh">
<xp:this.action><![CDATA[#{javascript:
print(this.getParent().getValue());
print(facesContext.getExternalContext().getRequestParameterMap().get(getClientId(this.getParent().getId())));
}]]></xp:this.action>
</xp:eventHandler>
</xp:radioGroup>
</xp:div>
</xp:view>
Thanks for your help.
Roger