点击“提交并发送电子邮件”后,我想停用提交按钮。这意味着用户点击“提交和电子邮件”后,提交按钮不应该是可点击的。我已根据反馈更新了答案。
; (function ($) {
$.fn.tpFormDialogCustom = function (method) {
var self = this;
var dialogButtons = [
{
text: "Submit and Email",
id: "tpFormDialog_btnSubmit",
click: submitandmailTpFormDialog
},
function submitandmailTpFormDialog() {
if(CheckValidate()) {
commonDialogs.showError(ExampleMessages.JournalError);
} else {
commonDialogs.showConfirm(ExampleMessages.ConfirmEmail, function() {
try {
commonDialogs.showProgress(ExampleMessages.SubmitAndEmail);
var o = getOptions();
var form = $(o.form);
form.ajaxSubmit({
success: handleEmailResponse,
beforeSerialize: function($form, options) {
if(!$("#SubmitBtn", $form).length) {
$('select.required', $form).prop('disabled', false);
$form.append("<input id='SubmitBtn' type='hidden' name='From' value='Submit' />");
}
}
});
} catch(e) {
commonDialogs.showError();
}
});
}
}
function handleEmailResponse(data) {
$('#tpFormDialog_btnSubmit').prop("disabled", true);
commonDialogs.hideProgress();
var o = getOptions();
if (data.IsSuccess) {
commonDialogs.showAck(ExampleMessages.ConfirmSendEmail);
closeTpFormDialog();
o.table.refresh();
} else {
var errors = data.ResponseModel;
if (typeof (errors) === 'string') {
commonDialogs.showError(errors);
} else {
helpForValidation.showErrors(errors);
}
}
};
答案 0 :(得分:0)
更新了该按钮的解除代码:
function handleEmailResponse(data) {
$('#tpFormDialog_btnSubmit').prop("disabled", true);
commonDialogs.hideProgress();
var o = getOptions();
if (data.IsSuccess) {
commonDialogs.showAck(ExampleMessages.ConfirmSendEmail);
closeTpFormDialog();
o.table.refresh();
} else {
var errors = data.ResponseModel;
if (typeof (errors) === 'string') {
commonDialogs.showError(errors);
} else {
helpForValidation.showErrors(errors);
}
}
};
您在$('tpFormDialog_btnSubmit').prop("disabled", true);