Skip to Main Content

Java Development Tools

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 ro read the value of a selectOneRadio in a Javascript function ?

lucborsNov 5 2008 — edited Nov 5 2008
I have a selectOneRadio, and when I change it's value I need that value to do something in a javascript function.
I need the actual value (ONE, TWO or ALL) in that function but it looks like I only get the index of the selected radioButton (0,1 or 2)

Here's my Page source:

<af:selectOneRadio id="typeRadio" label="Type"
clientComponent="true"
autoSubmit="true"
binding="#{bean.TypeRadio}"
value="#{bean.Type}"
valueChangeListener="#{bean.typeChanged}">
<af:selectItem label="First Choice" value="ONE"/>
<af:selectItem label="Second Choice" value="TWO"/>
<af:selectItem label="All" value="ALL"/>
<af:clientListener method="setType" type="valueChange" />
</af:selectOneRadio>

Here's my js function;

function setType(evt)
{
var typeComp = evt.getSource().findComponent('typeRadio');
if (typeComp !=null){
alert('type = '+ typeComp.getValue());
type = compType.getValue());
//do some more actions and calculations
}
}

The Bolded alert shows me 0, 1 or 2 and not ONE, TWO or ALL.

Am I missing something ?
This post has been answered by Frank Nimphius-Oracle on Nov 5 2008
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 3 2008
Added on Nov 5 2008
2 comments
400 views