8 Replies Latest reply on Aug 14, 2009 6:10 AM by nbelaevski

    Generated id of the components included in multiple pages

      I have a page - main.xhtml which includes following two pages
      - frame1.xhtml
      - frame2.xhtml
      Note: Only one among frame1.xhtml and frame2.xhtml will be displayed at a time.

      Both frame1.xhtml and frame2.xhtml include a common page - dateField.xhtml

      dateField.xhtml has a selectOneMenu. The complete id of this field is always w.r.t frame1


      main.xhtml

      <ui:fragment rendered="#{frameMgdBean.type=='frame1'}" >
       <a4j:include id="frame1page" viewId="/websites/frame1.xhtml"/>
      </ui:fragment>
      <ui:fragment rendered="#{frameMgdBean.type=='frame2'}" >
       <a4j:include id="frame2page" viewId="/websites/frame2.xhtml"/>
      </ui:fragment>
      


      frame1.xhtml
      <a4j:include viewId="/websites/dateField.xhtml"/>
      



      frame2.xhtml
      <a4j:include viewId="/websites/dateField.xhtml"/>
      



      dateField.xhtml
      <h:selectOneMenu id="frameDateRange" >
       <a4j:support event="onchange" onsubmit="setDate()"/>
       <h:inputHidden id="currentDate" value=""/>
       <f:selectItem itemValue="-1" itemLabel=""/>
       <f:selectItem itemValue="Next Hour"/>
       <f:selectItem itemValue="Last Hour"/>
      </h:selectOneMenu>
      
      <script>
      
       function setDate() {
       alert('#{rich:clientId('currentDate')}');
       }
      
      </script>
      


      The alert always displays 'frame1page:currentDate'. When the frame2.xhtml is rendered, I want the alert to display 'frame2page:currentDate'