You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Peter Mahoney <pm...@digitalbrain.com> on 2005/06/15 18:13:38 UTC

Radio buttons in dataTable

I am trying to use the x:selectOneRadio component with the spread 
layout. The radio button choices are rendered dynamically as part of a 
dataTable. However, the setter in the backing bean is not being called 
and I am getting an error in the logs:

"There should always be a submitted value for an input if it is 
rendered, its form is submitted, and it is not disabled or read-only."

from HtmlRendererUtils. This method appears to be looking for a value 
submitted by the x:selectOneRadio component. However, each of the 
options has been rendered with a unique name and therefore is not being 
found. Is this correct? As only one value can be submitted, surely the 
names should all be the same?

The code which causes this is:

<h:dataTable value="#{question.answers}" var="answer" style="width:100%">
    <f:facet name="header">
        <h:panelGroup rendered="#{question.typeBoolean}">
            <x:selectOneRadio id="radioChoice" 
value="#{question.booleanResponse}" required="true" 
rendered="#{question.typeOne}" disabled="#{!handler.poll.updatable}" 
layout="spread">
                <f:selectItems value="#{question.answerOptions}"/>
            </x:selectOneRadio>
            <x:selectManyCheckbox id="checkChoice" 
value="#{question.responses}" rendered="#{question.typeMany}" 
disabled="#{!handler.poll.updatable}" layout="spread">
                <f:selectItems value="#{question.answerOptions}"/>
              </x:selectManyCheckbox>
         </h:panelGroup>
      </f:facet>
      <h:column>
           <x:radio for="radioChoice" index="#{answer.answerNumber - 1}" 
rendered="#{question.typeOne}"/>
           <x:checkbox for="checkChoice" index="#{answer.answerNumber - 
1}" rendered="#{question.typeMany}"/>
       </h:column>
</h:dataTable>

This code worked correctly with the RI.

Peter