Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to pass a h:selectOneRadio value to JavaScript

843842Sep 15 2006 — edited Sep 15 2006
I 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>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 13 2006
Added on Sep 15 2006
1 comment
89 views