Server side FocusManager doesn't work
flavioeasy Feb 22, 2013 12:17 PMHi all,
I tried to use the server side FocusManager but I'm not able to let it work.
What I see is that the form is freezed and does not respond when I push the commandButton.
Below is the code.
Any hint would be appreciated.
Flavio
public void preRenderView() { FocusManager focusManager = ServiceTracker.getService(FocusManager.class); focusManager.focus("A2_1"); }
<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" xmlns:richext="http://java.sun.com/jsf/composite/richext"> <!-- <rich:jQuery query="focus().select()" selector="#ESSocEditPanelGrid :input:visible:enabled:first" name="focusFirst"/> --> <f:event type="preRenderView" listener="#{eSSoc.preRenderView()}" /> <h:form id="ESSocEditPanelForm"> <rich:popupPanel id="ESSocEditPanel" autosized="false" keepVisualState="false" domElementAttachment="parent" width="720" height="245" headerClass="panel-header-class" resizeable="true" onshow="focusFirst();"> <f:facet name="header"> <h:outputText value="#{eSSoc.headerEditPanel}"/> </f:facet> <f:facet name="controls"> <es:esUtilClosePanel varAction="#{rich:component('ESSocEditPanel')}.hide();"/> </f:facet> <h:panelGroup layout="block" styleClass="scrolls"> <a4j:outputPanel id="ESSocTableMod" ajaxRendered="true"> <h:panelGrid columns="2" id="ESSocEditPanelGrid"> <h:outputText value="#{mess.labelSocId}"/> <h:outputText value="#{eSSoc.ESSoc.a2id}" rendered="#{!eSSoc.insert}"/> <h:inputText id="A2_0" value="#{eSSoc.key}" size="7" maxlength="7" rendered="#{eSSoc.insert}" style="#{eSSoc.getStyle('0')}" /> <h:outputText value="#{mess.labelSocDes}"/> <h:inputText id="A2_1" value="#{eSSoc.ESSoc.a2deso}" size="100" maxlength="100" style="#{eSSoc.getStyle('1')}"/> <richext:spacer height="5" width="20" /> <richext:spacer height="5" width="20" /> <h:outputText value="#{mess.labelUserIns}"/> <h:outputText value="#{eSSoc.ESSoc.a2usin}" /> <h:outputText value="#{mess.labelDataIns}"/> <h:outputText value="#{eSSoc.ESSoc.a2dtin}" > <f:convertDateTime pattern="#{curLocale.dateTimePattern}" timeZone="#{esUty.curTZ}" /> </h:outputText> <h:outputText value="#{mess.labelUserVar}"/> <h:outputText value="#{eSSoc.ESSoc.a2usva}" /> <h:outputText value="#{mess.labelDataVar}"/> <h:outputText value="#{eSSoc.ESSoc.a2dtva}" > <f:convertDateTime pattern="#{curLocale.dateTimePattern}" timeZone="#{esUty.curTZ}" /> </h:outputText> <a4j:commandButton action="#{eSSoc.confirmData}" render="ESSocTable" oncomplete="if (!ajaxRequestContainsErrors()) #{rich:component('ESSocEditPanel')}.hide();" image="/resources/images/check.png" title="#{mess.tipConferma}"/> </h:panelGrid> </a4j:outputPanel> </h:panelGroup> </rich:popupPanel> </h:form> </ui:composition>