5 Replies Latest reply on Aug 5, 2015 4:05 AM by Michal Petrov

    FocusManager on PopupPanel

    Flavio Palumbo Newbie

      Hi all,

       

      i'd like ti use server side FocusManager on a PopupPanel but it seems not work when the PopupPanel is displayed for the first time.

       

      After the first ajax submission it start to work propertly.

       

      Follows the code.

       

      Any hint would be appreciated.

       

      <!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">

       

          <f:event type="preRenderView" listener="#{focusManagerBean.preRenderView}" />

          <rich:panel header="Enforcing Focus of Given Input">

              <h:form id="form">

                      <a4j:commandButton render="testFocusPopupPanelEditPanel"

                                         oncomplete="if (!ajaxRequestContainsErrors()) #{rich:component('testFocusPopupPanelEditPanel')}.show();"

                                         value="Popup" >

                      </a4j:commandButton>

              </h:form>

          </rich:panel>

          <ui:include src="/uty/testFocusPopupPanel.xhtml"/>

      </ui:composition>

       

       

      <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:a4j="http://richfaces.org/a4j"

                      xmlns:ui="http://java.sun.com/jsf/facelets"

                      xmlns:es="http://java.sun.com/jsf/composite/esutils"

                      xmlns:rich="http://richfaces.org/rich">

          <h:form id="testFocusPopupPanelForm">

              <rich:popupPanel id="testFocusPopupPanelEditPanel" autosized="false" domElementAttachment="parent"

                               width="720" height="325" headerClass="panel-header-class" resizeable="true">

                  <f:facet name="header">

                      <h:outputText value="Test Focus con Popup Panel"/>

                  </f:facet>

                  <f:facet name="controls">

                      <es:esUtilClosePanel varAction="#{rich:component('testFocusPopupPanelEditPanel')}.hide();"/>

                  </f:facet>

                  <a4j:outputPanel id="testFocusPopupPanelTableMod" ajaxRendered="true">

                      <rich:panel>

                          <h:panelGrid columns="2" id="testFocusPopupPanelGrid">

                              input1: <h:inputText id="input1" />

                              input2: <h:inputText id="input2" />

                              input3: <h:inputText id="input3" />

                          </h:panelGrid>

                      </rich:panel>

                      <rich:panel>

                          <a4j:commandButton value="Ajax Request" />

                      </rich:panel>

                  </a4j:outputPanel>

              </rich:popupPanel>

          </h:form>

      </ui:composition>