2 Replies Latest reply on Oct 12, 2011 8:00 AM by Mikalai Ushanau

    Multiple forms on one page.

    Mikalai Ushanau Newbie

      Hi, I have very strange issue. I have very complicated page, so I can't post it all, but I can describe it.

      So I have 3 <h:form></h:form> there. First form contains large table with something like schedule. Second form contains information for sending by Email. And third form used to fill some data to table. So I press button in table and it shows third form, it is very simple:

       

      <rich:popupPanel id="homework-panel" autosized="true" modal="true"

                                   moveable="false" resizeable="false">

                      <f:facet name="header">

                          <h:graphicImage value="/resources/images/icons/book_open.png" styleClass="icon" />

                          <h:outputText value="#{msg.homework_header}"/>

                          <a4j:commandLink onclick="#{rich:component('pupilPanel')}.hide(); return false;" style="float: right;" >

                              <h:graphicImage value="/resources/images/icons/bullet_arrow_down.png" />

                          </a4j:commandLink>

                      </f:facet>

                      <h:form id="homework-form">

                          <h:inputTextarea value="#{markBean.currentHomework.text}"

                                           id="homework-text" styleClass="homework-text" />

                          <a4j:commandButton value="#{msg.save}" action="#{markBean.saveHomework}"

                                             render="marks-grid" execute="@form" id="save-homework-link"

                                             oncomplete="#{rich:component('homework-panel')}.hide();" />

                          <a4j:commandButton value="#{msg.cancel}" id="cancel-homework-link"

                                             onclick="#{rich:component('homework-panel')}.hide(); return false;" />

       

                      </h:form>

      </rich:popupPanel>

       

      But it doesn't work! At all... Save button does nothing. I see no error message and back bean markBean.saveHomework method isn't called. At the same time table in first form and form for sending work fine. I tried to change places of form, but it didn't help.

       

      Page structure is something like:

       

      <h:form id="form">

                      <rich:panel styleClass="large-window">

                          <rich:dataTable>

      ...

                          </rich:dataTable>

                      </rich:panel>

      <h:form>

      <rich:popupPanel id="send-panel" autosized="true" modal="true"

                                   moveable="false" resizeable="false">

                      <h:form id="send-form">

      ...

                      </h:form>

      </rich:popupPanel>

      <rich:popupPanel id="homework-panel" autosized="true" modal="true"

                                   moveable="false" resizeable="false">

                      <h:form id="homework-form">

      ...

                      </h:form>

      </rich:popupPanel>

       

        • 1. Re: Multiple forms on one page.
          Brendan Healey Master

          Hi, one thing to try is to specify the ajax targets (i.e. render= & execute=) in the form

          :formid:componentid rather than formid:componentid. This will search from the view root. This

          is described in the javadoc for the UIViewRoot#findComponent() method. Although probably

          not a problem I've never tried using the '-' character in an id.

           

          With your complex page structure it may be worthwhile re-creating the overall structure,

          without the distraction of all the content, in a simple test project or page.

          • 2. Re: Multiple forms on one page.
            Mikalai Ushanau Newbie

            Thanks for answer. It's funny but I've just wrapped all my content in the third form with <a4j:outputPanel> and all works with render="homework-output-panel" and don't work with render="homework-panel"