0
在suggestioinField組件中添加ajax呈現器後,當前我面臨div組件的問題,div顯示更改爲none。如何使頁面即使在想要採取行動之後,仍留在同一頁面。在JSF中使用java腳本或Ajax呈現選項使div標記可見
這是我用來隱藏和顯示紅利
function AddShow(id){
document.getElementById(id).style.display="block";}
添加按鈕,顯示div標籤的JavaScript函數:
<h:commandButton type="button" id="cmdadd1" value="#{message.btn__list_add}" onclick="AddShow('Add')" immediate="true"/>
JSF網頁div內容
<div id="Add" display:none;">
<h:outputLabel value="#{message.label_listA }" />
<o:suggestionField id="addvalA" value="#{MainAction.CodeAdd}" customValueAllowed="false"
manualListOpeningAllowed="true" autoComplete="true" suggestionMinChars="1 onchange="O$.ajax.request(this,event,{ execute: 'frmList: addvalA ', listener: ‘MainAction.doSelectCodeAdd', render: 'frmList' })"onkeydown="O$.ajax.request(this,event,{listener: 'MainAction.doResetA'})" onblur="O$.ajax.request(this,event,{render:'frmList'})" ><o:dropDownItems value="#{MainAction.doCodeAdd}"/> </o:suggestionField>
<h:commandButton id="cmdAddConfirm" value="#{message.btn_create}" >
<f:ajax execute="@form" render="@form" listener="#{MainAction.doConfirmAdd}"/>
</h:commandButton>
</div>
有沒有辦法做到這一點?