Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
1.1.0
-
None
-
None
-
None
-
Windows XP Pro sp2, Tomcat 4.1.31
Description
I've run into an issue with version 1.1.0 when trying to implement a x:selectOneRadio tag within the h:dataTable tag where only one row from the data table can have the radio button selected. In version 1.0.9, I used the forceId and forceIdIndex attributes in the x:selectOneRadio tag to force the id of each x:selectOneRadio to be the same. Each row in the h:dataTable will have x:selectOneRadio with only one SelectItem in it, but since the id's are the same, the browser handles it correctly.
However, with version 1.1.0 in the validateValue(FacesContext, Object) method of the javax.faces.component.UISelectOne class, there is a call to _SelectItemsUtil.matchValue(FacesContext, Object, Iterator, _ValueConverter) which checks to see if the selected value of the x:selectOneRadio exists in the list of SelectItems. Since each row in the data table has a x:selectOneRadio with only one SelectItem, this check will only return true for the row where the radio button is selected. All other rows cause this check to fail and add a 'Value is not a valid option' error to the context messages list, which prevents the page from performing any other actions.
Here is an example of how I am using the x:selectOneRadio:
<h:dataTable
cellspacing="0"
style="padding-top: 0px; padding-bottom: 0px;"
styleClass="form-sub-table"
value="#
"
var="person">
<h:column>
<h:outputText value="#
#
{person.lastName}" escape="false" />
</h:column>
<h:column>
<x:selectOneRadio id="preside"
forceId="true"
forceIdIndex="0"
value="#
"
valueChangeListener="#
"
style="margin: 0px; border: 0px;"
border="0">
<f:selectItem itemValue="#
{person.personId}" itemLabel="" />
</x:selectOneRadio>
</h:column>
</h:dataTable>
It's not completely clear to me why the existence of the x:selectOneRadio value in it's child SelectItems needs to be enforced so strictly. I propose that this check be either optional or eliminated all toghether.
Thanks,
Jason Allen
Attachments
Issue Links
- duplicates
-
MYFACES-592 tomahawke SelectOneRadio in datatable no longer working
- Closed