我有一個JSF頁面,其中某些字段在其他字段的「onchange」事件被調用時動態呈現。還有一個彈出式面板,點擊一個按鈕即可打開。 這裏是頁的簡化版本:將焦點設置在RichFaces中的彈出式面板和動態呈現字段4.1.0
<h:form id="testForm">
<h:panelGrid id="testPanel" columns="2">
<h:inputText id="text0" />
<h:inputText id="text1">
<f:ajax event="change" listener="#{popupMBean.renderDynamicData}"
render="@form" />
</h:inputText>
<h:inputText id="text2" rendered="#{popupMBean.renderDynamic}" />
<h:inputText id="text3" />
<a4j:commandButton id="open" value="Open" render="testPopup"
oncomplete="#{rich:component('testPopup')}.show();" />
</h:panelGrid>
</h:form>
<rich:popupPanel id="testPopup" height="100"
domElementAttachment="form" header="Test">
<f:facet name="controls">
<h:commandButton value="Close"
onclick="#{rich:component('testPopup')}.hide()"></h:commandButton>
</f:facet>
<a4j:outputPanel id="test">
<a4j:commandButton id="first" value="First" />
<a4j:commandButton id="second" value="Second" />
</a4j:outputPanel>
</rich:popupPanel>
我有我需要通過使用鍵盤的所有字段來遍歷需求。以下是所面臨的問題:
- 當我點擊「打開」按鈕,它顯示的彈出面板,但 焦點未設置爲在彈出的第一輸入元件。
- 當用戶關閉彈出窗口時,應將焦點設置爲生成彈出窗口的字段或其旁邊的字段。
- 調用字段「text1」上的更改事件後,焦點將移回到頁面上的第一個輸入元素,即「text0」而不是新呈現的字段「text2」。
感謝。