[ 
https://issues.apache.org/jira/browse/MYFACES-4169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16249861#comment-16249861
 ] 

Eduardo Breijo edited comment on MYFACES-4169 at 11/13/17 5:39 PM:
-------------------------------------------------------------------

I have found the root cause of the issue. The visit() method in 
HtmlRendererUtils under SelectOneGroupSetSubmittedValueCallback only considers 
the following case:

                        <h:selectOneRadio id="radio0" group="someGroup" 
value="#{selectOneRadioGroupBean.selectedValue}">
                                <f:selectItem itemValue="Value1" />
                                <f:selectItem itemValue="Value2" />
                                <f:selectItem itemValue="Value3" />
                        </h:selectOneRadio>
        
                        <h:selectOneRadio id="radio1" group="someGroup" />
                        <h:selectOneRadio id="radio2" group="someGroup" />

It will set the submittedValue to the first h:selectOneRadio component (since 
it has the value expression), and then in the validateValue() method of 
UISelectOne in the API, we go through each of the select items and verify if it 
is in there.

Now for the case where there is an issue, the submittedValue will be set to the 
first component as well (since it has the VE), but in the validateValue() 
method of UISelectOne in the API, there is only one select item in the first 
component, which does not match the submitted value, resulting in the 
Validation Error.


was (Author: eduardobreijo):
I have found the root cause of the issue. The visit() method in 
HtmlRendererUtils under SelectOneGroupSetSubmittedValueCallback only considers 
the following case:

                        <h:selectOneRadio id="radio0" group="someGroup" 
value="#{selectOneRadioGroupBean.selectedValue}">
                                <f:selectItem itemValue="Value1" />
                                <f:selectItem itemValue="Value2" />
                                <f:selectItem itemValue="Value3" />
                        </h:selectOneRadio>
        
                        <h:selectOneRadio id="radio1" group="someGroup" />
                        <h:selectOneRadio id="radio2" group="someGroup" />

It will set the submittedValue to the first h:selectOneRadio component (since 
it has the value expression), and then in the validate() method of UISelectOne 
in the API, we go through each of the select items and verify if it is in there.

Now for the case where there is an issue, the submittedValue will be set to the 
first component as well (since it has the VE), but in the validate() method of 
UISelectOne in the API, there is only one select item in the first component, 
which does not match the submitted value, resulting in the Validation Error.

> selectOneRadio grouping broken
> ------------------------------
>
>                 Key: MYFACES-4169
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4169
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-372
>    Affects Versions: 2.3.0-beta
>            Reporter: Paul Nicolucci
>            Assignee: Thomas Andraschko
>             Fix For: 2.3.0
>
>         Attachments: JSF23SelectOneRadioGroup.war, 
> SelectOneRadioGroupBean.java, index.xhtml, selectOneRadioGroupOneValue.xhtml
>
>
> I was testing out the new group attribute on the <h:selectOneRadio/> 
> component and found that it does not look to work in all scenarios:
> I've provided a test application to shows a working scenario and then 
> multiple scenarios that I think should work but don't.
> The app can be deployed on tomcat. 
> You can drive a request to the index page which will contain the links what 
> doesn't work: 
> http://localhost:8080/JSF23SelectOneRadioGroup/index.xhtml
> Or you can directly verify what does not work by sending requests to:
> localhost:8080/JSF23SelectOneRadioGroup/error.xhtml
> localhost:8080/JSF23SelectOneRadioGroup/error2.xhtml
> localhost:8080/JSF23SelectOneRadioGroup/error3.xhtml
> localhost:8080/JSF23SelectOneRadioGroup/error4.xhtml



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to