我有以下有效的代码,但是您可以帮我修改它吗,
它会在提交之前验证表单,默认情况下它可以工作,但是会带您回到列表。
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script>
$(document).ready(function(){
var targetURL = 'http://sp/Lists/Test/AllItems.aspx';
//For Cancel Button
$("input[value='Cancel']").click(function(event){
//event.preventDefault();
window.location.replace("http://sp/Lists/TestDetails/AllItems.aspx");
})
//For Save Button
var saveButton = $("input[value='Save']");
saveButton.removeAttr("onclick");
saveButton.click(function() {
if (!PreSaveItem()) return false;
if (SPClientForms.ClientFormManager.SubmitClientForm('WPQ2')){
window.history.pushState('redirectRrl', 'redirectRrl', 'http://sp/Lists/MyList/NewForm.aspx?Source='+targetURL+'');
return false;
}
var oldActionUrl = $('#aspnetForm').attr('action');
var oldSource = GetUrlKeyValue("Source", true, oldActionUrl);
var newActionUrl = oldActionUrl.replace(oldSource, encodeURIComponent(targetURL));
var elementName = $(this).attr("name");
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true, "", newActionUrl, false, true));
});
});
</script>
电子邮件未存储在具有以上代码的列表列中