I made change like this by adding true to itemValue, <h:selectOneRadio required="true" > <f:selectItem itemValue="true" itemLabel="Button1"/> <f:selectItem itemValue="false" itemLabel="Button2" /> </h:selectOneRadio>
but, its not changing.
Thanks, Vinutha
Remko Strating
Ranch Hand
Joined: Dec 28, 2006
Posts: 893
posted
0
In your example code I miss the value of the backingbean within your <h:selectOneRadio /> Tag.
Normally the option is chosen which is the value of your backing bean. You can give this value your wanted default value.
I made change like this by adding true to itemValue, <h:selectOneRadio required="true" > <f:selectItem itemValue="true" itemLabel="Button1"/> <f:selectItem itemValue="false" itemLabel="Button2" /> </h:selectOneRadio>
but, its not changing.
Thanks, Vinutha
Hi Vinutha, you forget the value attribute for the selectOneRadio like this: <h:selectOneRadio required="true" value="#{MyBean.valueAttr}" > <f:selectItem itemValue="true" itemLabel="Button1"/> <f:selectItem itemValue="false" itemLabel="Button2" /> </h:selectOneRadio>
so if you put true or false to the valueAttr in your Bean the radio will appear selected.
Hope this helps
vinutha
Greenhorn
Joined: Nov 29, 2006
Posts: 29
posted
0
Hi Andres,
Thanks for your reply. Its working now.
Thanks a lot. Thanks, Vinutha.
Bert Bates
author
Sheriff
Joined: Oct 14, 2002
Posts: 8712
posted
0
hi vinutha,
please update your display name to match the avaRanch policy - include both your first and last names.
Thanks, and welcome to the ranch
Bert
Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: How to select one Radio button by default.