myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Commented] (MYFACES-4115) Implement h:selectOneRadio "group" (distributed radio button)
Date Wed, 03 May 2017 06:07:04 GMT


Leonardo Uribe commented on MYFACES-4115:

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:

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

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

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

The rendered markup by Mojarra (RI) is this:


<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>


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:
>             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

View raw message