0

I am rendering a table with , which has a radio button. i.e. , on selection of radioButton, need to re-render the whole form. but which is not working.

Here is my code:

<h:form id="summaryForm" prependId="false">
<table>
<tbody>
  <ui:repeat var="switchRow" value="#{designBean.switchReport.rowList}" varStatus="rowStatus">
     <tr class="#{rowStatus.even?'even':'odd'}">
      <td>
     <h:selectOneRadio id="switchTypeSelectionId" 
                  name="switchTypeSelection" 
              styleClass="choices"
              onclick="selectRadioButton(this);"
              value="#{designBean.designTool.switchProduct}">
      <f:selectItem itemValue="#{switchRow.rowId}"/>
      <f:ajax event="click" execute="@this" render="@form" listener="#{designBean.showIGBTDetails}"/>
    </h:selectOneRadio>
    </td>
    <ui:repeat var="switchColValue" value="#{switchRow.rowValues}">
        <td>
                    <h:outputText value="#{switchColValue}" /> 
                </td>
    </ui:repeat>
      </tr>
     </ui:repeat>
</tbody>
</table>
</h:form>
uday
  • 315
  • 3
  • 7
  • 17
  • Your `` attribute contains a syntax error in the EL expression. Is this also present in your real code? – BalusC Jun 15 '12 at 13:01
  • 1
    Okay, the EL syntax error is thus not the cause of your concrete problem. Now we can finally advance :) This problem is recognizable as a bug in an older Mojarra version. Are you using Mojarra? If so, which version? If it's rather old (more than ~6 months), have you tried upgrading it? – BalusC Jul 04 '13 at 15:36

2 Answers2

0

I don't know if a click event is what you need in this case. Try using onchange. I remember something that mentioned this in the past. However it wont fire if you click multiple times on the already selected radio item.

Also, did you try using the id of the form instead @form? Like render="summaryForm".

Sven Plath
  • 558
  • 1
  • 5
  • 17
  • When using the id of the form instead @form, Like what you suggested render="summaryForm", which is giving me the following exception. when i looked at view source, generated html the component id is same summaryForm. SEVERE: javax.faces.FacesException: contains an unknown id 'semiSelectionForm' - cannot locate it in the context of the component switchTypeSelectionId – uday Jun 15 '12 at 05:57
  • Well, this sounds strange. But i forgot something: Maybe it's better to use a colon, render=":summaryForm". JSF is using a colon as ID seperator, (consider a form with id foo nested in something with the id bar, you could access it with foo:bar or :foo:bar. I am no expert here when to use which but it might be worth a try. But, to be honest, I am kind of stuck here. Maybe there are restrictions using this stuff in a element. – Sven Plath Jun 15 '12 at 12:44
0

After some research, i found a simple way to achieve this, Here is my answer, instead of using h:selectOneRadio, changed it to HTML and wrapped it in a , now the click on panelGrid component calling the ajax function/listener.

<h:form id="summaryForm" prependId="false">
<table>
<tbody>
  <ui:repeat var="switchRow" value="#{designBean.switchReport.rowList}" varStatus="rowStatus">
     <tr class="#{rowStatus.even?'even':'odd'}">
      <td>
          <h:panelGrid id="switchSelectionId" styleClass="choices">
                <input type="radio" name="switchTypeSelection" value="#{switchRow.rowId}" />
                <f:ajax event="click" execute="@this" render="@form" listener="#{designBean.showIGBTDetails}"/>
          </h:panelGrid>
      </td>
      <ui:repeat var="switchColValue" value="#{switchRow.rowValues}">
        <td>
             <h:outputText value="#{switchColValue}" /> 
        </td>
      </ui:repeat>
      </tr>
     </ui:repeat>
</tbody>
</table>
</h:form>
uday
  • 315
  • 3
  • 7
  • 17