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

Leonardo Uribe edited comment on MYFACES-4115 at 5/3/17 6:07 AM:
-----------------------------------------------------------------

I started this one some days ago, with the expectation that this one could be 
easily solved, but later I found that implement the spec javadoc "as is" does 
not work.

The problem starts in this example:

{code:xml}
    <h:form id="mainForm">
        <h:selectOneRadio id="radio0" group="someGroup" 
value="#{selectOneGroupBean.selectedValue}">
            <f:selectItems value="#{selectOneGroupBean.myValues}" />
        </h:selectOneRadio>

        <h:selectOneRadio id="radio1" group="someGroup" />
        <h:selectOneRadio id="radio2" group="someGroup" />

        <br/>
        <h:outputText value="Selected Value: 
#{selectOneGroupBean.selectedValue}"/>
        <br/>
        <h:commandButton value="Submit" 
actionListener="#{selectOneGroupBean.update}"/>
    </h:form>
{code}

The rendered markup by Mojarra (RI) is this:

{code:xml}

<input type="radio" name="mainForm:someGroup" id="mainForm:radio0" 
value="mainForm:radio0:A A" />
<label for="mainForm:radio0"> A A</label>
<input type="radio" name="mainForm:someGroup" id="mainForm:radio1" 
value="mainForm:radio1:B-B" />
<label for="mainForm:radio1"> B-B</label>
<input type="radio" name="mainForm:someGroup" id="mainForm:radio2" 
value="mainForm:radio2:C_C" />
<label for="mainForm:radio2"> C_C</label>

{code}

Take a look at the "value" attribute. It appends the clientId and the value. 
This means when decode() happens, only the component with the right clientId 
takes the value. But please note only radio0 has the EL expression pointing to 
the model. Which means at some point setSubmittedValue(...) is called, but if 
is not in decode(), when? 

There is also another problem caused by submitted values not processed by the 
validation step. The spec talks about skip processValidation(...) with some 
conditions, to avoid validation step over components that does not have the 
validators and the EL "value" expression. 

In my opinion this part is unstable. I guess I could find more holes in it, but 
by some reason the implementation in Mojarra works, at least for the basic 
example.




was (Author: lu4242):
I started this one some days ago, with the expectation that this one could be 
easily solved, but later I found that implement the spec javadoc "as is" does 
not work.

The problem starts in this example:

{code:xml}
    <h:form id="mainForm">
        <h:selectOneRadio id="radio0" group="someGroup" 
value="#{selectOneGroupBean.selectedValue}">
            <f:selectItems value="#{selectOneGroupBean.myValues}" />
        </h:selectOneRadio>

        <h:selectOneRadio id="radio1" group="someGroup" />
        <h:selectOneRadio id="radio2" group="someGroup" />

        <br/>
        <h:outputText value="Selected Value: 
#{selectOneGroupBean.selectedValue}"/>
        <br/>
        <h:commandButton value="Submit" 
actionListener="#{selectOneGroupBean.update}"/>
    </h:form>
{code}

The rendered markup by Mojarra (RI) is this:

{code:xml}

<input type="radio" name="mainForm:someGroup" id="mainForm:radio0" 
value="mainForm:radio0:A A" />
<label for="mainForm:radio0"> A A</label>
<input type="radio" name="mainForm:someGroup" id="mainForm:radio1" 
value="mainForm:radio1:B-B" />
<label for="mainForm:radio1"> B-B</label>
<input type="radio" name="mainForm:someGroup" id="mainForm:radio2" 
value="mainForm:radio2:C_C" />
<label for="mainForm:radio2"> C_C</label>

{code:xml}

Take a look at the "value" attribute. It appends the clientId and the value. 
This means when decode() happens, only the component with the right clientId 
takes the value. But please note only radio0 has the EL expression pointing to 
the model. Which means at some point setSubmittedValue(...) is called, but if 
is not in decode(), when? 

There is also another problem caused by submitted values not processed by the 
validation step. The spec talks about skip processValidation(...) with some 
conditions, to avoid validation step over components that does not have the 
validators and the EL "value" expression. 

In my opinion this part is unstable. I guess I could find more holes in it, but 
by some reason the implementation in Mojarra works, at least for the basic 
example.



> Implement h:selectOneRadio "group" (distributed radio button)
> -------------------------------------------------------------
>
>                 Key: MYFACES-4115
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4115
>             Project: MyFaces Core
>          Issue Type: New Feature
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>
> Implement h:selectOneRadio "group" (distributed radio button)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to