Display value of 'checked' radio button
Hi,
I have 3 radio buttons on my jsp page and I would like the value of the radio button that has been selected, to be alerted in a pop-up message.
This is my code:
JSP,
[CODE]<h:form id='msForm'>
function checkSearchType()
{
alert(document.getElementById('msForm:searchType').checked);
}
<h:selectOneRadio id="searchType" layout="pageDirection" value="#{searchAction.searchType}" styleClass="tabBold" onClicking="javascript:checkSearchType();">
f:selectItem itemValue="0" itemLabel="A"
f:selectItem itemValue="1" itemLabel="B"
f:selectItem itemValue="2" itemLabel="C"
</h:selectOneRadio>[/CODE]
Action class,
[CODE]private String searchType = null;
public String getSearchType() {
return this.searchType;
}
public void setSearchType(String a_iSearchType) {
this.searchType = a_iSearchType;
}[/CODE]
The pop-up returns 'undefined'. Where am I going wrong? Kindly help.

