6 Replies Latest reply: Mar 31, 2011 9:42 AM by Julien Martin RSS

    Strange behavior of h:form inside a rich:datagrid

    Julien Martin Expert

      Hello,

      I have a h:form inside a rich:datagrid and the action method of the form is never called. Moreover the prependId=false attribute is ignored.

       

       

      Here is what the html looks like:

      <form id="j_idt100:6:formulaireInscriptionSculpture" name="j_idt100:6:formulaireInscriptionSculpture" method="post" action="/jeanbaptistemartin/lang/fr/galerie" enctype="application/x-www-form-urlencoded">

      <input type="hidden" name="j_idt100:6:formulaireInscriptionSculpture" value="j_idt100:6:formulaireInscriptionSculpture" />

      <table>

      <thead>

      <tr><th colspan="1" scope="colgroup">
                      <span class="formulaireFermer"><a class="fermerFormulaireInscription">Fermer</a></span></th></tr>
      </thead>
      <tfoot>
      <tr><td colspan="1"><span class="inscriptionDescription">*(Vous serez informé(e) par email des nouvelles sculptures de Jean-Baptiste Martin au fur et à mesure qu'elles apparaitront sur le site)</span></td></tr>
      </tfoot>
      <tbody>
      <tr>
      <td>Restez informé(e) des nouvelles sculptures* :</td>
      </tr>
      <tr>
      <td><table>
      <tbody>
      <tr>
      <td><span id="j_idt100:6:abonneEmailP"><input id="j_idt100:6:email" type="text" name="j_idt100:6:email" value="" class="abonneEmail" size="15" title="Votre email" /></span></td>
      <td><input id="j_idt100:6:soumettreInscription" name="j_idt100:6:soumettreInscription" onclick="RichFaces.ajax(&quot;j_idt100:6:soumettreInscription&quot;,event,{&quot;incId&quot;:&quot;1&quot;} );return false;" value="Créer l'alerte" type="submit" /></td>
      <td><span id="j_idt100:6:j_idt127"><span style="display:none" class="rf-st-start"><img src="/jeanbaptistemartin/images/ajax-loader-bar.gif" /></span><span class="rf-st-stop"></span><script type="text/javascript">new RichFaces.ui.Status("j_idt100:6:j_idt127")</script></span></td>
      </tr>
      </tbody>
      </table>
      </td>
      </tr>
      <tr>
      <td><span id="j_idt100:6:messageEmailP"><span id="j_idt100:6:messageEmail"></span></span></td>
      </tr>
      </tbody>
      </table>
      <span id="j_idt100:6:j_idt131" style="display: none;"><script type="text/javascript">reinitialiserFormulaire=function(){RichFaces.ajax("j_idt100:6:j_idt131",null,{"incId":"1"} )};</script></span><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-1981625827725610618:434758034946481652" autocomplete="off" />
      </form>

       

       

      Here is the jsf:

                          <rich:dataGrid value="#{galerieView.sculptures}" var="sculpture" columns="3" styleClass="datagrid-galerie" iterationStatusVar="iterations">

                              <h:panelGroup rendered="#{!iterations.last}">

                                  <p>

                                      <pretty:link mappingId="sculptureAction" styleClass="miniature-link">

                                          <f:param value="#{view.locale.language}"/>

                                          <f:param value="#{jbm:normaliserURL(sculpture.sculpturei18nMap[view.locale.language].titre)}" />

                                          <f:param value="#{sculpture.sculptureID}" />

                                          <h:graphicImage value="#{initParam['com.jeanbaptistemartin.static.url']}/#{sculpture.photoMiniature}" styleClass="miniature-image" alt="#{sculpture.sculpturei18nMap[view.locale.language].titre}, #{sculpture.sculpturei18nMap[view.locale.language].matiere}, #{jbm:renvoyerAnnee(sculpture.annee)}."/>

                                      </pretty:link>

                                  </p>

                                  <p>

                                      <pretty:link mappingId="sculptureAction" styleClass="miniature-link-text">

                                          <f:param value="#{view.locale.language}"/>

                                          <f:param value="#{jbm:normaliserURL(sculpture.sculpturei18nMap[view.locale.language].titre)}" />

                                          <f:param value="#{sculpture.sculptureID}" />

                                          <h:outputText value="#{sculpture.sculpturei18nMap[view.locale.language].titre}, " />

                                          <h:outputText value="#{sculpture.sculpturei18nMap[view.locale.language].matiere}" />

                                      </pretty:link>

                                  </p>

                              </h:panelGroup>

                              <h:panelGroup rendered="#{iterations.last}" styleClass="miniature-link">

                                  <p id="sellette">

                                      <img src="#{facesContext.externalContext.requestContextPath}/images/200x200.gif" class="miniature-image" alt="" onclick="slideUp()"/>

                                  </p>

                                  <div class="formulaireInscriptionSculpture">

                                      <h:form id="formulaireInscriptionSculpture" prependId="false">

                                          <ui:include src="WEB-INF/include/formulaire-inscription-sculpture.xhtml"/><!-- todo: ne fonctionne pas... -->

                                      </h:form>

                                  </div>

                              </h:panelGroup>

                              <rich:jQuery name="slideUp" query="slideUp({duration:'slow'});slideDownForm()" selector="#sellette"/>

                              <rich:jQuery name="slideDownForm" query="slideDown({duration:'slow'})" selector="div.formulaireInscriptionSculpture" />

                              <rich:jQuery name="slideDownSellette" query="slideDown({duration:'slow'})" selector="#sellette"/>

                          </rich:dataGrid>

       

      Here is the included form:

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                      xmlns:ui="http://java.sun.com/jsf/facelets"

                      xmlns:h="http://java.sun.com/jsf/html"

                      xmlns:f="http://java.sun.com/jsf/core"

                      xmlns:a4j="http://richfaces.org/a4j"

                      xmlns:rich="http://richfaces.org/rich">

          <a4j:region>

              <h:panelGrid columns="1">

                  <f:facet name="header">

                      <span class="formulaireFermer"><a href="" class="fermerFormulaireInscription"><h:outputText value="#{msg['formulaire.fermer']}"/></a></span>

                  </f:facet>

                  <h:panelGroup>

                      <h:outputText value="#{msg['inscription.accroche']}"/>

                  </h:panelGroup>

                  <h:panelGroup>

                      <h:panelGrid columns="3">

                          <a4j:outputPanel id="abonneEmailP">

                              <h:inputText id="email"  styleClass="abonneEmail" title="#{msg['message.from.email']}" value="#{gestionnaireInscriptionView.abonneEmail}" required="true" label="#{msg['message.from.email']}" requiredMessage="#{msg['message.valeurRequise.email']}" size="15">

                                  <f:validator validatorId="adresseEmailValidator"/>

                              </h:inputText>

                          </a4j:outputPanel>

                          <a4j:commandButton id="soumettreInscription" action="#{gestionnaireInscriptionView.sauvegarderAbonne}" value="#{msg['creer.alerte']}" render="messageEmailP,abonneEmailP" type="submit"/>

                          <ui:include src="status-bar.xhtml"/>

                      </h:panelGrid>

                  </h:panelGroup>

                  <h:panelGroup>

                      <a4j:outputPanel id="messageEmailP"><h:message id="messageEmail" for="email" showSummary="true" showDetail="false" infoClass="champValide" errorClass="champInvalide"/></a4j:outputPanel>

                  </h:panelGroup>

                  <f:facet name="footer">

                      <h:outputText value="#{msg['inscription.description']}" styleClass="inscriptionDescription"/>

                  </f:facet>

              </h:panelGrid>

          </a4j:region>

          <a4j:jsFunction name="reinitialiserFormulaire"

                          immediate="true"

                          render="email"

                          actionListener="#{gestionnaireInscriptionView.reinitialiserFormulaire}"/>

      </ui:composition>

       

      Does anyone have any idea why my app exhibits this behaviour?

       

      Thanks in advance,


      J.