3 Replies Latest reply on Jan 23, 2008 3:59 AM by dkane

    Ajax form in each table row - only the one in last row works

    dkane

      Hello
      I have the following construction :

      - rich:tabpanel , where tabs are being generated with c:forEach
      - on each tab, rich:panelBar where bars are being generated with c:forEach
      - on each bar, rich:dataTable
      - in each dataTable row I have a:form :

      <rich:column>
      <a:form>
       <h:panelGrid columns="2">
       <h:inputText value="#{termprop.stringValue}"/>
       <a:commandButton value="Set" action="#{terminalAdm.updateProperty(subgroupitem.subgroup.key, termprop.code)}"/>
       </h:panelGrid>
      </a:form>
      </rich:column>
      


      termprop.setStringValue :

      public void setStringValue(String stringValue)
      {
       this.stringValue = stringValue;
       System.out.println("value was set to "+stringValue);
      }
      
      


      terminalAdm.updateProperty :

      public void updateProperty(String subgroupKey, String propKey)
      {
       System.out.println("Updating property name="+propKey);
       .....
      }
      



      The problem :
      When I click "Set" in the last table row, I get both logging messages as expected :

      19:19:41,671 INFO [STDOUT] Updating property name=C450
      19:19:48,140 INFO [STDOUT] value was set to 44444444

      When I click "Set" in any row that is not last, I get only
      19:19:48,140 INFO [STDOUT] Updating property name=C470

      but not message from setter.

      I.e. form is being submitted but value from h:inputText does not come.

      Any ideas ?

      Thank you



        • 1. Re: Ajax form in each table row - only the one in last row w
          akakunin

          Confirmed, we meet same problem with a4j:repeat - then form is included inside a4j:repeat

          • 2. Re: Ajax form in each table row - only the one in last row w
            brachie

            Hi,

            I am having the same problem with a <a:commandLink> in a table:

            <tr:table styleClass="trTableDiv" id="personss"
             rows="10" columnClasses="col"
             value="#{allePersonen}" var="pers">
             <tr:column>
             <f:facet name="header">Name</f:facet>
             <h:outputText
             value="#{pers.vorname} #{pers.nachname}" />
             </tr:column>
             <tr:column>
             <f:facet name="header">select</f:facet>
             <a:commandLink reRender="panelProjekt" action="#{projekt.setMandant(pers)}" value="set">
             <s:conversationId />
             </a:commandLink>
             </tr:column>
            </tr:table>


            When I click the commandLink only the last person in the table is passed to the action-Method #{projekt.setMandant(pers)}.

            Any suggestions?

            Regards,

            Alexander

            • 3. Re: Ajax form in each table row - only the one in last row w
              dkane

              brachie,

              My current workaround is following.
              When a:form is around the whole datatable (but a:commandlink is in each table row) I have all fields from all rows submitted. Then I have to know which exact row has been clicked, in order to throw out unnecessary form parameters come from other rows. This could be done by passing some id or so with a:actionparam.
              Ugly solution, of course. Waiting for answer/fix to have small a:form in each row.