Home » SharePoint » Item ID in display and edit forms

Item ID in display and edit forms

Open up the View page for any of your list items and add ToolPaneView=2 onto the end of the URL to open up the page in edit mode.

Note – if you already have a query string (&ID=xzx…) on the end of the url then you need to use &ToolPaneView=2 and if you don’t its ?ToolPaneView=2 e.g.

http://yoursite/Lists/Tasks/DispForm.aspx?ID=1

=> http://yoursite/Lists/Tasks/DispForm.aspx?ID=1&ToolPaneView=2

http://yoursite/Lists/Tasks/DispForm.aspx

=> http://yoursite/Lists/Tasks/DispForm.aspx?ToolPaneView=2

Next add a Content Editor Web Part (CEWP) to the page and put the following code into it using the Edit Source button.

add the open script here

//
// Item ID in DispForm.aspx and EditForm.aspx
// Feedback and questions: david@coellogroup.com coellogroup.com
//
function DisplayItemID()
{
var regex = new RegExp(“[\\?&]”+”ID”+”=([^&#]*)”);
var qs = regex.exec(window.location.href);
var TD1 = document.createElement(“TD”);
TD1.className = “ms-formlabel”;
TD1.innerHTML = “<h3 class=’ms-standardheader’>Issue ID</h3>”;
var TD2 = document.createElement(“TD”);
TD2.className = “ms-formbody”;
TD2.innerHTML = qs[1];
var IdRow = document.createElement(“TR”);
IdRow.appendChild(TD1);
IdRow.appendChild(TD2);
var ItemBody = GetSelectedElement(document.getElementById(“idAttachmentsRow”),”TABLE”).getElementsByTagName(“TBODY”)[0];
ItemBody.insertBefore(IdRow,ItemBody.firstChild);
}

_spBodyOnLoadFunctionNames.push(“DisplayItemID”);

add close script here

 

reference: http://blog.pathtosharepoint.com/2009/01/18/item-id-in-display-and-edit-forms/

Share

Comments are closed.