4 Replies Latest reply on Feb 16, 2011 4:58 PM by esford

    Using rich:calender on rich:popupPanel

    jensmander

      Hi,

       

      I am trying to use the calender component inside of a popupPanel but it doesn't work like expected. The calender does not show up. Do I have to use the component in a different way wheather using it inside or outside a popupPanel?

      Here is a little snipped that demonstrates the misbehaviour.

       

      <!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:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:rich="http://richfaces.org/rich">
      <f:view>
          <ui:insert name="metadata" />
          <h:head>
          </h:head>
          <h:body>
              <h:form>
                 <!-- Works perfectly -->
                  <rich:calendar value="#{testBean.date}" id="outerCal"
                      cellWidth="24px" cellHeight="22px" style="width:200px">
                  </rich:calendar>
                  <h:commandButton value="Call the popup">
                      <rich:componentControl target="popup" operation="show" />
                  </h:commandButton>
                  <rich:popupPanel id="popup" modal="false" autosized="true"
                      resizeable="false">
                      <f:facet name="header">
                          <h:outputText value="Simple popup panel" />
                      </f:facet>
                      <f:facet name="controls">
                          <h:outputLink value="#"
                              onclick="#{rich:component('popup')}.hide(); return false;">
                          X
                      </h:outputLink>
                      </f:facet>
                      <h:form>
                          <!-- Datepicker doesn't show up -->
                          <rich:calendar value="#{testBean.date}" id="innerCal"
                              cellWidth="24px" cellHeight="22px" style="width:200px">
                          </rich:calendar>
                      </h:form>
                  </rich:popupPanel>
              </h:form>
          </h:body>
      </f:view>
      </html>
      

       

      Regards

       

      Sascha

        • 1. Re: Using rich:calender on rich:popupPanel
          esford

          You've got a nested form.  Remove the <h:form> and its closing tag from around the <rich:calendar> tag.  Or, more appropriately, move the popupPanel tag and all of its contents outside of the main form tag.

          • 2. Re: Using rich:calender on rich:popupPanel
            jensmander

            Sorry, but that changes anything

            If it's not a bug in Richfaces4 does anybody have a working example for me?

            • 3. Re: Using rich:calender on rich:popupPanel
              jensmander

              Hi,

               

              serendipitously I found a solution for that problem. First of all Eric you're totaly right with the nested forms. I won't work like that. But that was not the main problem. There must be any rendering issue with the calender component. If I open the popupPanel like that, the calender component works as expected.

               

                   <h:commandButton value="Call the popup">
                              <f:ajax execute="@none" render=":frmCal" />
                              <rich:componentControl target="popup" operation="show" />
                   </h:commandButton>
              

               

              Regards

               

              Sascha

              • 4. Re: Using rich:calender on rich:popupPanel
                esford

                Regrettably I haven't had the opportunity to start working with RF 4 yet so I couldn't comment on possible bugs causing the behavior.  I just noticed the nested form and knew that would not work as you expected.