Change Onclick Event of sumbit button of sharepoint

function ModifyPendingFunction() 

{
var currentPathname = location.pathname;
currentPathname = currentPathname.toLowerCase();
//Sing Form
if (currentPathname.indexOf('/signform.aspx') > 0)
{
var pending = $("input[id*=btnActions_Action1]");
if (pending.length>0) {

var strJS = pending.attr("onclick");
strJS = strJS.replace("javascript:", "");
pending.attr('onclick', '');
pending.click(function (e) {
if (!CheckCommentForPending())
{
e.preventDefault();
}
else {
new Function(strJS)();
}
});
}

}
}
function CheckCommentForPending(strJS)
{
var comment = $("textarea[id*=fld_Body]").val();
if (comment == "") {
alert("Please give your comment!");
return false;
}
else {
return true;
}
}

_spBodyOnLoadFunctionNames.push('ModifyPendingFunction');

posted @ 2017-09-07 14:08  【上海】Peter  阅读(109)  评论(0)    收藏  举报