Override redirect using EditItemWithCheckoutAlert

On an edit item link, you want to perform some operation and redirect to a page of your choice, write a small script on your page and override the EditItemWithCheckoutAlert function.
So when you click on the edit link, the EditForm.aspx opens.


This allows you to modify the fields and delete the list item. Once you perform your desired action, the dialog box is closed and you are redirected to previous view/default view. To override this, use the script below, modify it to suit your URL and put it in a CEWP/Script Editor WP on your page.




if (typeof(EditItemWithCheckoutAlert) != 'undefined')
{
var changed_EditItemWithCheckoutAlert = EditItemWithCheckoutAlert;
EditItemWithCheckoutAlert = function(evt, Url, bCheckout, bIsCheckedOutToLocal, strDocument, strhttpRoot, strCurrentUser, strCheckoutUser) {
changed_EditItemWithCheckoutAlert(evt, Url+'&Source=yourURL', bCheckout, bIsCheckedOutToLocal, strDocument, strhttpRoot, strCurrentUser, strCheckoutUser);
};
}


Advertisements