1 2 Previous Next 21 Replies Latest reply on Aug 18, 2009 6:42 AM by sam-user Go to original post
      • 15. Re: Error evaluate oncomplete function undefined on modalPan
        nbelaevski

        Try wrapping Richfaces.showModalPanel() in try/catch and alert exception message.

        • 16. Re: Error evaluate oncomplete function undefined on modalPan
          sam-user

          Hello,
          I get the following error:

          'panel.component' is null or not an object
          




          • 17. Re: Error evaluate oncomplete function undefined on modalPan
            ilya_shaikovsky

            please alert also what rich:element and rich:component calls returns.

            • 18. Re: Error evaluate oncomplete function undefined on modalPan
              sam-user

              When I use

              #{rich:component('addNote')}.show();


              instead of

              Richfaces.showModalPanel


              I get this exception when I try to execute it the first time
              'document.getElementById(...).component' is null or not an object.


              Using rich:element instead of rich:component (if I understood correctly) returns

              Object doesn't support this property or method


              • 19. Re: Error evaluate oncomplete function undefined on modalPan
                sam-user

                More digging into this revealed that it may have something to do with the switchType of the tabPanel.

                Here is a summary of the cases:


                1. Using Richfaces.showModalPanel()

                1.1. switchType of the parent tabPanel is "ajax" - the first type the modalPanel opens, but after clicking on another tab and back the modalPanel fails to open

                1.2 switchType of the parent tabPanel is "client" - the modalPanel always opens after clicking on another tab and back. This,however, causes problems with some of the functionality on the other tabs


                2. Using #{rich:component('addNote')}.show() does not work at all - I always get the error messages posted earlier



                So, is this a known issue, or could this be a bug?

                Thanks


                • 20. Re: Error evaluate oncomplete function undefined on modalPan
                  ilya_shaikovsky

                   

                   <rich:tabPanel switchType="ajax">
                   <rich:tab label="first">
                   first
                   </rich:tab>
                   <rich:tab label="123123">
                   <rich:modalPanel id="panel" width="350" height="100">
                   <f:facet name="header">
                   <h:panelGroup>
                   <h:outputText value="Modal Panel"></h:outputText>
                   </h:panelGroup>
                   </f:facet>
                   <f:facet name="controls">
                   <h:panelGroup>
                   <h:graphicImage value="/images/modal/close.png" styleClass="hidelink" id="hidelink"/>
                   <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
                   </h:panelGroup>
                   </f:facet>
                   <h:outputText value="This panel is called using Component Control Component"></h:outputText>
                   <br/>
                   <h:outputText value="Closure link (X) works also through Component Control"></h:outputText>
                   </rich:modalPanel>
                   <h:form>
                   <a4j:commandButton value="open panel" oncomplete="#{rich:component('panel')}.show()"></a4j:commandButton>
                   </h:form>
                   </rich:tab>
                   </rich:tabPanel>
                  


                  still can't reproduce with this code at 3.3.2 snapshot. :(

                  • 21. Re: Error evaluate oncomplete function undefined on modalPan
                    sam-user

                    I think I finally found out what the problem is.

                    The problem is that my modalPanel was in a subview. Once I moved it out of the subview it worked.

                    Here's the Ilya's example, but with the modalPanel in a subview - the way it was in my app. I also added a command button with a Richfaces call, instead of rich:component. As you'll see in this case rich:component causes a Syntax error to be displayed during rendering.

                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                    
                    
                     <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                     xmlns:h="http://java.sun.com/jsf/html"
                     xmlns:f="http://java.sun.com/jsf/core"
                     xmlns:ui="http://java.sun.com/jsf/facelets"
                     xmlns:a4j="http://richfaces.org/a4j"
                     xmlns:rich="http://richfaces.org/rich"
                     xmlns:s="http://jboss.com/products/seam/taglib"
                     xmlns:bsf="http://jakarta.apache.org/taglibs/"
                     xmlns:mj="http://mojarra.dev.java.net/mojarra_ext"
                     xmlns:richfaces="http://richfaces.ajax4jsf.org/rich"
                     xmlns:ajax="https://ajax4jsf.dev.java.net/ajax"
                     template="layout/template.xhtml">
                     <ui:define name="body">
                     <rich:tabPanel switchType="ajax">
                     <rich:tab label="first">first</rich:tab>
                     <rich:tab label="Second">
                     <h:form>
                     <a4j:commandButton value="open panel" oncomplete="#{rich:component('panel')}.show()" />
                     <a4j:commandButton value="open panel Richfaces" oncomplete="Richfaces.showModalPanel('panel')" />
                     </h:form>
                    
                     </rich:tab>
                     </rich:tabPanel>
                     </ui:define>
                    
                     <f:subview 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:a="http://richfaces.org/a4j"
                     xmlns:rich="http://richfaces.org/rich">
                    
                     <rich:modalPanel id="panel" width="350" height="100">
                     <f:facet name="header">
                     <h:panelGroup>
                     <h:outputText value="Modal Panel"></h:outputText>
                     </h:panelGroup>
                     </f:facet>
                     <f:facet name="controls">
                     <h:panelGroup>
                     <h:graphicImage value="/images/modal/close.png" styleClass="hidelink" id="hidelink"/>
                     <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
                     </h:panelGroup>
                     </f:facet>
                     <h:outputText value="This panel is called using Component Control Component"></h:outputText>
                     <br/>
                     <h:outputText value="Closure link (X) works also through Component Control"></h:outputText>
                     </rich:modalPanel>
                     </f:subview>
                    </ui:composition>
                    
                    



                    I'm just wondering why is putting the tabPanel in a subview a problem. Is it wrong to do it this way and if yes, why?

                    Thanks for your help.

                    1 2 Previous Next