7 Replies Latest reply on Jul 10, 2009 8:37 AM by hrbaer

    problems with modal panel

      Hi everybody,

      I'm trying to add a modal panel to my webapp but I'm still having some problems with my modal panel.

      I want to submit some form-informations of the modal panel so I tried to reproduce this example(http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/rich_modalPanel.html)

      This is my code:

      <html>
      <head></head>
      <body>
      <f:view>
      
      (...)
      <f:subview>
      <h:form>
      
      (...)
      <rich:modalPanel id="kommentar">
       <f:facet name="header">
       <h:outputText value="What ever..." />
       </f:facet>
       <f:facet name="controls">
       <h:commandLink value="Close" style="cursor:pointer" onclick="Richfaces.hideModalPanel('kommentar')" />
       </f:facet>
       <p>
       <br>blabla:<br><br>
       <h:inputTextarea value="#{mb.newKommentar}" cols="40" rows="5" />
       </p>
       <h:form>
       <h:commandButton value="Kommentar erfassen" actionListener="#{mb.anzeigeKontakt}" />
       <h:commandLink actionListener="#{mb.anzeigeKontakt}" value="Test" />
       </h:form>
      </rich:modalPanel>
      (...)
      
      </h:form>
      </f:subview>
      (...)
      
      </f:view>
      </body>
      </html>
      


      (The bold code was just an attempt of an already working link)
      In both cases I don't reach my action-Method in my managed bean.

      Can anybody help me?
      Thanks in advance!

        • 1. Re: problems with modal panel
          nbelaevski
          • 2. Re: problems with modal panel

             

            "nbelaevski" wrote:
            Covered in the project FAQ: http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/faq/faq.html#d0e417


            I'm completely lost.
            Isn't that example exactly what I did?

            • 3. Re: problems with modal panel

              Hi,

              If you want to perform action for modal panel, you must have a separate form inside it. In this case, the panel must be declared outside of the other form on the same page. the preceding code snippet would be helpful.

              <html>
              <head></head>
              <body>
              <f:view>
              <h:form>
              </h:form>
              <rich:modalPanel id="kommentar">
               <f:facet name="header">
               <h:outputText value="What ever..." />
               </f:facet>
               <f:facet name="controls">
               <h:commandLink value="Close" style="cursor:pointer" onclick="Richfaces.hideModalPanel('kommentar')" />
               </f:facet>
               <p>
               <br>blabla:<br><br>
               <h:inputTextarea value="#{mb.newKommentar}" cols="40" rows="5" />
               </p>
               <h:form>
               <h:commandButton value="Kommentar erfassen" actionListener="#{mb.anzeigeKontakt}" />
              
              <h:commandLink actionListener="#{mb.anzeigeKontakt}" value="Test" />
              
               </h:form>
              </rich:modalPanel>
              </f:view>
              </body>
              </html>
              


              • 4. Re: problems with modal panel

                 

                "giftsam" wrote:
                ...In this case, the panel must be declared outside of the other form on the same page.


                omg, I placed it right befor the closing form ... thought It would be outside.
                Thank you!

                • 5. Re: problems with modal panel

                  Hi,

                  I'm still having some problems to get the value of the entered text in my modal panel.

                  <html>
                  <head></head>
                  <body>
                  <f:view>
                  <h:form>
                  </h:form>
                  <rich:modalPanel id="kommentar">
                   <f:facet name="header">
                   <h:outputText value="What ever..." />
                   </f:facet>
                   <f:facet name="controls">
                   <h:commandLink value="Close" style="cursor:pointer" onclick="Richfaces.hideModalPanel('kommentar')" />
                   </f:facet>
                   <p>
                   <br>blabla:<br><br>
                   <h:inputTextarea value="#{mb.newKommentar}" cols="40" rows="5" />
                   </p>
                   <h:form>
                   <h:commandButton value="Kommentar erfassen" actionListener="#{mb.addComment}" />
                  
                   </h:form>
                  </rich:modalPanel>
                  </f:view>
                  </body>
                  </html>
                  


                  I reach the method addComent by clicking on the button but the value newKommentar is always null. Is it because the modal panel isn't nested inside the form?

                  • 6. Re: problems with modal panel
                    ilya_shaikovsky

                    no. Modal should not be nested inside a form. But inputTextArea should.

                    • 7. Re: problems with modal panel

                       

                      "ilya_shaikovsky" wrote:
                      no. Modal should not be nested inside a form. But inputTextArea should.


                      Thanks!