2 Replies Latest reply on Mar 14, 2007 7:26 PM by Sergey Smirnov

    ModalPanel needs forceId

    Andrew Wheeler Newbie

      When using modalPanel with facelets inside a composition I have to use javascript to determine the JSF generated id. Is there a better way than the example below:

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
       xmlns:h="http://java.sun.com/jsf/html">
      
      <script type="text/javascript">
      <!--
       function findJSFComponent(knownName) {
       var elements = document.getElementsByTagName("*");
      
       for(e=0;e<elements.length;e++) {
       if (elements[e].id.indexOf(knownName)>0)
       return elements[e].id;
       }
      
       return knownName;
       }
      -->
      </script>
      
      <rich:modalPanel id="lookupPersonModal" width="400" height="500" top="200" zindex="2000">
       <f:facet name="header">Lookup person</f:facet>
      
       <h:outputLink value="javascript:Richfaces.hideModalPanel(findJSFComponent('lookupPersonModal'))">Close</h:outputLink>
      </rich:modalPanel>
      
      <div class="button-group">
       <h:commandButton id="lookupPerson" value="Lookup" styleClass="command-button" type="button" onclick="javascript:Richfaces.showModalPanel(findJSFComponent('lookupPersonModal'))"/>
      </div>
      
      </ui:composition>
      


      By the way there is no documentation for modalPanel in the JBoss release. What is the reason for this?