JS 获取Button控件的提交类型

时间:2023-02-04 14:49:40
 <script type="text/javascript">
<!--获取button控件的类型--->
function isAuditOrCancel(value) {
document.getElementById("audittype").value = value;
}
</script>
<!--声明变量,到后台接收--->
<%: Html.Hidden("audittype")%>
 <li>
<div class="buttonActive">
<div class="buttonContent">
<button type="submit" onclick="isAuditOrCancel('audit')">
提交审批
</button>
</div>
</div>
</li>
<li>
<div class="buttonActive">
<div class="buttonContent">
<button type="submit" onclick="isAuditOrCancel('cancel')">
撤消
</button>
</div>
</div>
</li>
<li>
<div class="button">
<div class="buttonContent">
<button type="button" class="close">
关闭
</button>
</div>
</div>
</li>

后台获取:

 string audittype = Request.Form["audittype"];
if (audittype == "cancel")
{
string refreshTab = Request.Form["refreshTab"];
WorkflowCancel(BusinessId);
return ReutrnSuccessStr("", "撤销成功", refreshTab, "closeCurrent");
}
else if(audittype=="audit" )
{
string taskid = Request["taskid"];
string Remark = Request.Form["Remark"] == null ? "" : Request.Form["Remark"];
Remark = Maxuni.Util.StringUtil.GetFilerStr(Remark);
string tabname = Request.Form["tabname"] == null ? "" : Request.Form["tabname"];
string DealwithResult = Request.Form["DealwithResult"] == null ? "" : Request.Form["DealwithResult"];
string jumpWorkflowid = Request.Form["NodeRoleName"] == null ? "" : Request.Form["NodeRoleName"];
bool isSendMsg = Request.Form["isSendMsg"] == "on" ? true : false;
WorkflowJumpByRole(taskid, DealwithResult, jumpWorkflowid, Remark.Replace("'", "\""), isSendMsg);
string IsHasNextNode = Request.Form["IsHasNextNode"];
if (IsHasNextNode == "no" && DealwithResult == "")//如果审批已完成
{
AuditCompleteSendMessage(taskid);
SaveOProcessRequisitionEmit(BusinessId, , mouldNo);
}
return ReutrnSuccessStr("", "提交成功", "", "closeCurrent");
}
}