cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving ID of selected RadioButton

Former Member
0 Kudos

Does anyone know how to retrieve the ID of the selected RadioButton in a RadioButtonGroup? When i find the selected RadioButton and do call getId() I get something weird, that references the group and a random letter set. If I do a getValueAsDataType().toString() I get "true."

How do you find the ID value for the selected RadioButton....that ID that you defined in the JSP?

Thanks!

View Entire Topic
Former Member
0 Kudos

Thanks, Praksh, but rb.getKey() gives me the <b>key</b> attribute value for the RadioButton. I am looking for the <b>id</b> attribute value for the RadioButton.

Do you know how to find this?

Former Member
0 Kudos

What about "getId()" is that not retrieving the id?

Former Member
0 Kudos

Hi Alexa,

getId() doesn't work. There is a bug with radio button controls. Use the work around i suggested above.

regards,

prakash

MartyMcCormick
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Alexa,

According to the API documentation for the radioButton, the key attribute for a radioButton is:

key

A string which is assigned to the radioButton when the form is sent to the server. A key string must be defined and must not be empty.

id

Identification name of the radioButton.

Can you set key and id to the same value? If not, are you populating the id and key attributes from a bean array? If so, you could always get the radio button id by grabbing the key and then cross referenceing (i.e. keep id at position 0 and key at position 1 in your radio button setup array).

Hope this helps,

Marty