How to pass a h:selectOneRadio value to JavaScript
843842Sep 15 2006 — edited Sep 15 2006I know that I am not sending the value of h:selectOneRadio right. Does anyone have an answer to this?
Thanks
Jim
<script type="text/javascript">
function myFunction(obj) {
alert("In javaScript");
if (obj == null)
alert("obj is null");
else
alert("obj is not null");
alert(obj.options[obj.selectedIndex].value);
}
</script>
<h:selectOneRadio id="colors" value="#{MyController.color}"
onclick="myFunction(this.form.colors)" styleClass="selectOneRadio">
<f:selectItem itemValue="1"
itemLabel="Red"/>
<f:selectItem itemValue="2"
itemLabel="Blue"/>
<f:selectItem itemValue="3"
itemLabel="Green"/>
</h:selectOneRadio>