jsf 2 - Cursor does not appear to set the focus on a inputext after a request -
when informing enrollment of employee not registered in given database system issues error , inputtext component loses focus. after few attempts component gets focus cursor not appear in field.
<h:form id="findform"> <!-- other --> <p:dialog id="mealregisterdialog" widgetvar="mealregisterdialog" header="#{lbl['mealregistercontrol']}" appendtobody="true" resizable="false" closable="true" width="100%" height="600" styleclass="container_24 clearfix grid_24"> <h:form id="mealregisterform" styleclass="container_24 clearfix grid_24"> <p:messages id="dialogmessages" closable="true" /> <div class="grid_24" style="border: 1; border-color: gray; border-style: solid; font-size: 20px"> <p:outputlabel value="#{lbl['employee']}" styleclass="grid_3" style="margin-top:5px;" /> <p:inputtext id="employeeregistrationinput" widgetvar="employeeregistrationinput" value="#{mealfindcontroller.employeeregistration}" styleclass="grid_21"> <f:convertnumber integeronly="true" /> <p:focus for="employeeregistrationinput" rendered="if(document.getelementbyid('mealregistertabview:findform:confirmdialoguser').visible)" /> <p:ajax event="change" process="@form employeeregistrationinput" update="@form dialogmessages" oncomplete="setfocusregistration();" listener="#{mealfindcontroller.loaddataemployee}" /> </p:inputtext> </div> </h:form> </p:dialog> <!-- other --> </h:form> function setfocusregistration() { employeeregistrationinput.jq.focus(); }
requestcontext.getcurrentinstance().execute( "focus(employeeregistrationinput)" );
Comments
Post a Comment