在请求之后,Cursor似乎没有将焦点设置在inputext上

时间:2014-03-10 18:03:29

标签: jsf-2 primefaces omnifaces

通知未在指定数据库中注册的员工的注册 系统发出错误,inputText组件失去焦点。 几次尝试后,组件获得焦点,但光标不会出现在字段中。

<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();             }

1 个答案:

答案 0 :(得分:0)

RequestContext.getCurrentInstance()。execute(“focus(employeeRegistrationInput)”);