It would be useful oftentimes in SharePoint, to be able to edit an item in a pop-up window. This can be done with a bit of Javascript in a Content Editor Web Part (CEWP) in the list view page concerned.

To use an additional Edit Content Block menu item as above, paste the following Javascript into a CEWP in the page concerned:

<script type=”text/javascript”>

function Custom_AddListMenuItems(m, ctx) {

var viewURL = window.location.protocol + “//” + window.location.host +

ctx.displayFormUrl + “?ID=” + currentItemID;

var editURL = window.location.protocol + “//” + window.location.host +

ctx.editFormUrl + “?ID=” + currentItemID;

var openMenu = CASubM(m,”Open in New Window”);

CAMOpt(openMenu, “View Item”, “window.open(‘” + viewURL + “‘);”);

CAMOpt(openMenu, “Edit Item”,

“window.open(‘” + editURL + “‘);”, “/_layouts/images/edititem.gif”);

return false; // render the default menu items too

}

</script>

With thanks to Jan Tielens

Advertisements