单击删除按钮时会显示自定义弹出窗口。点击禁用删除。 当用户点击确定或取消按钮后,删除操作后启用“删除”按钮。 单击对话框中的X按钮时,对话框立即关闭但删除按钮仍处于禁用状态。下面是我的代码
按钮代码
<a4j:commandButton id="btnDelete" execute="@form" value="Delete" onclick="this.disabled=true;javascript:showModalPopup('delete_popup_id','btnDelete',300);" tabindex="4" immediate="true" />
showModalPopup函数使用jQuery打开对话框
/ **此功能用于打开show modal popup * /
function showModalPopup(popupId, popUpWidth) {
$( "#"+popupId).dialog({
modal: true,
width: popUpWidth,
resizable: false
});
}
自定义弹出式代码
<div id="delete_popup_id" title="Application name" class="divOff">
<h:form ">
<h:outputText value="" />
<div align="center" id="timerButtonPanel">
<h:commandButton value="ok" action="" />
<h:commandButton value="cancel"/>
</div>
</h:form>
</div>
答案 0 :(得分:0)
将您的javascript showModelPopup
功能更改为:
function showModalPopup(popupId,popUpWidth){
$( "#"+popupId).dialog({
modal: true,
width: popUpWidth,
resizable: false,
close: enableDeleteButton
});
}
添加此javascript函数以启用删除按钮。
function enableDeleteButton(){
document.getElementById('btnDelete').disabled=false;
}