9 Replies Latest reply on Sep 19, 2007 2:38 PM by Maksim Kaszynski

    Problem using rich:modalPanel from a facelets template

    Milli Coelho Newbie

      Hi,

      I have a rich:modalPanel attached to a button click which works when I define it directly in any page. But if I try to have it in a template file defined as ui:composition and include it in a page using ui:include, it is shown by default without even clicking the button.

      I tried different things and I'm clueless. Any help is appreciated.

      Thanks,
      Raj

        • 1. Re: Problem using rich:modalPanel from a facelets template
          Maksim Kaszynski Apprentice

          Please show facelets you mentioned above.

          • 2. Re: Problem using rich:modalPanel from a facelets template
            Milli Coelho Newbie

             

            modalPanel.xhtml
            
            <ui:component xmlns="http://www.w3.org/1999/xhtml"
             xmlns:s="http://jboss.com/products/seam/taglib"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:a4j="http://richfaces.org/a4j"
             xmlns:rich="http://richfacesorg/rich">
             <rich:modalPanel id="testPanel" height="310" zindex="2000" resizeable="false">
             <f:facet name="header">
             <h:outputText value="Test Panel" />
             </f:facet>
             <f:facet name="controls">
             <h:graphicImage value="/img/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('testPanel')" />
             </f:facet>
             <p> testing </p>
             </rich:modalPanel>
            


            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
             xmlns:s="http://jboss.com/products/seam/taglib"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:rich="http://richfaces.ajax4jsf.org/rich"
             xmlns:c="http://java.sun.com/jstl/core"
             xmlns:a4j="http://richfaces.org/a4j"
             template="layout/standardtemplate.xhtml">
             <ui:define name="centercontent">
             <td align="center" valign="top" class="centercontent">
             <h:outputLink value="#" >
             <h:graphicImage
             url="img/call_button.gif"
             onclick="javascript:Richfaces.showModalPanel('testPanel');"
             style="border:0;height:24;width:81"/>
             </h:outputLink>
             <ui:include src="layout/modalPanel.xhtml"/>
             </td>
             </ui:define>
            </ui:composition>
            


            standardtemplate.xhtml contains my page layouts. In the above code if I replace ui:include with rich:modalPanel it works. But with ui:include the modalPanel is rendered as part of the page after the button.

            • 3. Re: Problem using rich:modalPanel from a facelets template
              Ilya Shaikovsky Master

              And here is my code:

              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <html xmlns="http://www.w3.org/1999/xhtml"
               xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:rich="http://richfaces.ajax4jsf.org/rich"
               xmlns:ui="http://java.sun.com/jsf/facelets">
              <ui:composition template="/templates/common.xhtml">
               <ui:define name="body">
               <a href="javascript:Richfaces.showModalPanel('_panel',{left:'auto', top:'auto'})">
               Show Modal Panel
               </a>
               <h:outputLink value="#" onclick="javascript:Richfaces.showModalPanel('_panel',{left:'auto', top:'auto'},{param1:'test'})">Open</h:outputLink>
              
               <ui:include src="/pages/greeting.xhtml" />
               </ui:define>
              </ui:composition>
              </html>
              


              and

              
              <f:subview xmlns="http://www.w3.org/1999/xhtml"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:rich="http://richfaces.ajax4jsf.org/rich"
               xmlns:a4j="http://richfaces.org/a4j">
              
               <rich:modalPanel id="_panel" showWhenRendered="#{bean.check}" left="300" top="300">
               <h:outputText value="123123123"></h:outputText>
               </rich:modalPanel>
              
              </f:subview>


              Works as expected. RF 3.1.0 GA

              • 4. Re: Problem using rich:modalPanel from a facelets template
                Milli Coelho Newbie

                thanks. I will try f:subView instead ui:composition

                • 5. Re: Problem using rich:modalPanel from a facelets template
                  Milli Coelho Newbie

                  It still does not work. I removed all my templates and created a simple test case. Could you someone try this to see if it works or not? I'm using Richfaces 3.1.0/Seam 1.2.1/JBoss 4.0.5 and FF.

                  dialer.xhtml
                  <?xml version='1.0' encoding='UTF-8' ?>
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <f:subview xmlns="http://www.w3.org/1999/xhtml"
                   xmlns:s="http://jboss.com/products/seam/taglib"
                   xmlns:ui="http://java.sun.com/jsf/facelets"
                   xmlns:f="http://java.sun.com/jsf/core"
                   xmlns:h="http://java.sun.com/jsf/html"
                   xmlns:a4j="http://richfaces.org/a4j"
                   xmlns:rich="http://richfacesorg/rich">
                   <rich:modalPanel id="dialer" height="310" zindex="2000" resizeable="false">
                   <f:facet name="header">
                   <h:outputText value="Click-n-Connect" />
                   </f:facet>
                   <f:facet name="controls">
                   <h:graphicImage value="/img/close.png" style="cursor:pointer" onclick="Richfaces.hideModalPanel('dialer')" />
                   </f:facet>
                   <p> testing1 </p>
                   </rich:modalPanel>
                  </f:subview>
                  


                  testpage.xhtml
                  <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml"
                   xmlns:s="http://jboss.com/products/seam/taglib"
                   xmlns:ui="http://java.sun.com/jsf/facelets"
                   xmlns:f="http://java.sun.com/jsf/core"
                   xmlns:h="http://java.sun.com/jsf/html"
                   xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                   xmlns:c="http://java.sun.com/jstl/core"
                   xmlns:a4j="http://richfaces.org/a4j">
                   <head>
                   <title></title>
                   </head>
                   <body>
                   <h:graphicImage
                   url="img/call_button.gif"
                   onclick="javascript:Richfaces.showModalPanel('dialer');"
                   style="border:0;height:24;width:81"/>
                  
                   <ui:include src="layout/dialer.xhtml"/>
                   </body>
                  </html>
                  


                  If I add modalPanel directly instead of ui:include it works as expected. When i use ui:include, I see the following in the final html source. Looks like rich:modalpanel is getting rendered directly without being encoded. And f:subview or ui:composition does not make any difference.

                  <rich:modalpanel _moz-userdefined="" resizeable="false" zindex="2000" height="310" id="dialer"></rich:modalpanel>
                  <p> testing123 </p>


                  • 7. Re: Problem using rich:modalPanel from a facelets template
                    Ilya Shaikovsky Master

                    The worst errors is syntax errors... :)))

                    This was hard to see from the beggining but
                    xmlns should be not
                    xmlns:rich="http://richfacesorg/rich"

                    as in your included file but

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

                    :)

                    • 8. Re: Problem using rich:modalPanel from a facelets template
                      Milli Coelho Newbie

                      How silly? Thanks for pointing it out and it works now. I hate syntax errors with no messages.