简体   繁体   English

关闭jQuery对话框后,a4j:commanbutton仍被禁用

[英]a4j:commanbutton still disabled after closing jquery dialog box

Custom pop up is displayed onclick of delete button.Delete is disabled onclick. 单击删除按钮时将显示自定义弹出窗口。单击禁用删除。 When user click on Ok or cancel button "Delete" button is enabled after delete operation. 当用户单击“确定”或取消按钮时,删除操作后将启用“删除”按钮。 When X button in dialog box is clicked , dialog is closed immediately but delete button still in disabled state.Below is my code 当单击对话框中的X按钮时,对话框立即关闭,但删除按钮仍处于禁用状态。以下是我的代码

Below code for button 下面的按钮代码

<a4j:commandButton id="btnDelete" execute="@form" value="Delete" onclick="this.disabled=true;javascript:showModalPopup('delete_popup_id','btnDelete',300);" tabindex="4" immediate="true" />

showModalPopup function using jQuery to open dialog box 使用jQuery打开对话框的showModalPopup函数

/** This function is used open show modal popup */ / **此功能用于打开显示模式弹出窗口* /

function showModalPopup(popupId, popUpWidth) {
    $( "#"+popupId).dialog({
        modal: true,
        width: popUpWidth,
        resizable: false
    }); 
}

code for custom pop up 自定义弹出代码

<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>

Change your javascript showModelPopup function to : 将您的javascript showModelPopup函数更改为:

function showModalPopup(popupId,popUpWidth){
    $( "#"+popupId).dialog({
        modal: true,
        width: popUpWidth,
        resizable: false,
        close: enableDeleteButton
    }); 
}

Add this javascript function to enable the delete button. 添加此javascript函数以启用删除按钮。

function enableDeleteButton(){
    document.getElementById('btnDelete').disabled=false;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM