3 Replies Latest reply on Oct 25, 2012 4:26 AM by datenklo

    rich:popupPanel - no element focussed

    datenklo

      Hello!

       

      I'm using rich:popupPanel and got a question:

      When the popupPanel is called via h:commandLink the focus is still set on the element (h:commandLink) I clicked on the site even when modal is set to "true".

      The h:commandLink on the site is executable via "enter" (and reopens the popup)!

      Is there any option to select the element which should be focussed when the popupPanel opens (e.g. on a close button)?

      On the other hand, is it possible to close a popupPanel via ESC key?

       

      Used richfaces version: 4.2.3

       

      Thanks and regards,

      Sebastian

        • 1. Re: rich:popupPanel - no element focussed
          datenklo

          popupPanel can be closed with the usage of <rich:hotKey>:

           

          <rich:hotKey key="Esc">

                            <rich:componentControl target="popup" operation="hide" />

          </rich:hotKey>

          <rich:popupPanel id="popup">

           

          ...

          1 of 1 people found this helpful
          • 2. Re: rich:popupPanel - no element focussed
            rhanus

            Hi Sebastian,

             

            inspire yourself by following code snippent which I use to enable password change in popup:

             

            <rich:popupPanel id="pp_changepasswd" autosized="true" modal="false" resizeable="false" moveable="true" onshow="#{rich:element('pp_currentPasswd')}.focus()">

                        <f:facet name="header">

                            <h:outputText value="#{labels.changePassword}"/>

                        </f:facet>

                        <h:form>

                            <rich:panel>

                                <h:panelGrid columns="3">

                                    <h:outputText value="#{labels.currentPassword}:"/>

                                    <h:inputText id="pp_currentPasswd"

                                                 value="#{changePasswordBean.currentPassword}"

                                                 size="30">

                                        <rich:validator event="blur"/>

                                    </h:inputText>

                                    <rich:message for="pp_currentPasswd"/>

                                    ...

             

            R.

            • 3. Re: rich:popupPanel - no element focussed
              datenklo

              Works like a charm!

              Thanks a lot Radim.