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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s