It's not a secret anymore!*
The moose likes JSF and the fly likes Radio Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Radio " Watch "Radio " New topic
Author

Radio

Joe Jose
Ranch Hand

Joined: Jan 14, 2004
Posts: 125
Hi,

I have t:selectOneRadio tag in a h:datatable. When radio button diplayed, it comes with the value. But I don't want to diplay the value of the radio button , but radio only. Could any one have any idea is it possible for t:selectOneRadio ?

Thanks,
Joe.
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
Have you tried like this?



See the value attribute, I think setting this to empty will not select any radio.
Joe Jose
Ranch Hand

Joined: Jan 14, 2004
Posts: 125
Thanks for the reply. I need to check it. Also I am using tomahawk selectOneRadio.

Thanks,
Joe.
Joe Jose
Ranch Hand

Joined: Jan 14, 2004
Posts: 125
Originally posted by Ali Gohar:
Have you tried like this?



See the value attribute, I think setting this to empty will not select any radio.



Unfortunately you solution didn't work for me. Is there any other way to satisfy my condition that is, don't display the value with radio button ?

Anyone has a thought ?

Thanks,
Joe
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
what do you mean by value? are you saying that when radio buttons display one of them is selected by default? or something else?
Yellapa Adepu
Ranch Hand

Joined: Jan 17, 2006
Posts: 34
If you mean not to display any of the radio buttons selected by default. Assing an invalid value to backing property.

<t:selectOneRadio id="addType" disabled="false" value="#{bean.addType}"
<f:selectItem itemLabel="Person" itemValue="person"/>
<f:selectItem itemLabel="Office" itemValue="office"/>
</t:selectOneRadio>

If you set backing bean property anything other than person or office. It won't be selected by default..

I hope it helps you.

Regards,


Yellapa Adepu<br />SCEA
Joe Jose
Ranch Hand

Joined: Jan 14, 2004
Posts: 125
Originally posted by Ali Gohar:
what do you mean by value? are you saying that when radio buttons display one of them is selected by default? or something else?


No I didn't mean selected by default value. I meant, when radio button displayed, it comes with its assigned value like some ids or names .Can I display just the radio only like we do in struts or html ? Am I clear ?

Thanks,
Joe.
Joe Jose
Ranch Hand

Joined: Jan 14, 2004
Posts: 125
Originally posted by Yellappa Adepu:
If you mean not to display any of the radio buttons selected by default. Assing an invalid value to backing property.

<t:selectOneRadio id="addType" disabled="false" value="#{bean.addType}"
<f:selectItem itemLabel="Person" itemValue="person"/>
<f:selectItem itemLabel="Office" itemValue="office"/>
</t:selectOneRadio>

If you set backing bean property anything other than person or office. It won't be selected by default..

I hope it helps you.

Regards,


What you meant by 'invalid' value ? Can you please explain a bit more ?

Thanks,
Joe.
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
Not understood exactly. Are you saying you don't want to show the labels with Radio Buttons? If it is the case then i guess don't provide the itemLabel or provide empty String ("") in itemLabel Attribute.
Joe Jose
Ranch Hand

Joined: Jan 14, 2004
Posts: 125
Sorry if am not clear.

The following is the code I have written for radio button (it is in datatable) :



I haven't given any itemLabel. But still it displayes like :

O quoteNo1
O quoteNo2

'O' represents radio and 'quoteNo1 and 2 ' represents the value comes in value and itemValue attribute. What I want is just display like :
O (without quoteNo) .

Am I still not clear ? Please bare with me.

Thanks,
Joe.
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
Ok have you tried using itemLabel="" inside <f:selectItem> ?
Joe Jose
Ranch Hand

Joined: Jan 14, 2004
Posts: 125
Originally posted by Ali Gohar:
Ok have you tried using itemLabel="" inside <f:selectItem> ?


Thank you very much Ali. That worked !!
I thoight if we put itemLabel it will display the label.So I hadn't tried.
A big big thank you to you.

Very thoughtful of you,
Joe.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Radio
 
Similar Threads
Call commandLink through radio button
selectoneRadio load with default value
rendering problem
passing hidden values
<t:selectoneradio layout="spread" styleClass="radio">