Hey Paul,

Would you mind updating the wiki page (Dynamic Example) at http://wiki.apache.org/myfaces/Display_Radio_Buttons_In_Columns ? I would, but I don't have access to it. When going by the current wiki page, the radio buttons will display, but nothing gets set when the form is posted.

To fix this, the t:selectOneRadio tag should not be inside the t:dataTable tag, but just underneath the h:form tag. Also, the "for" attribute of the t:radio tags should use an absolute id. Below is a modified example. There's also an added value attribute in the t:selectOneRadio tag, so "public String selectedButton" (plus setters/getters) will also need to be added to RadioButtons.java.

<h:form id="theForm">

    <t:selectOneRadio id="buttons" 
                      value="buttonList.selectedButton"
                      layout="spread" 
                      forceId="true" 
                      forceIdIndex="false">
        <f:selectItems value="#{buttonList.selectList}" />
    </t:selectOneRadio>

    <t:dataTable newspaperColumns="3" 
                 var="row" 
                 value="#{buttonList.dataModel}" 
                 rowIndexVar="index">
        <h:column>
            <t:radio for="" index="#{index}" />
        </h:column>
    </t:dataTable>

</h:form>


View this message in context: Re: How can I display radio buttons in 2 columns?
Sent from the MyFaces - Users forum at Nabble.com.

Reply via email to