Goal: Prevent a completed task from being edited.
- Content Editor Web Part (CEWP)
- Finds table cells with the word “Completed”
- Finds the parent row and then the second cell in the row
- Replaces that cells contents with the name of the task and a hyperlink to a message
- Add a Content Editor Web Part:
- Go to Site Actions, Edit Page
- Add a Content Editor Web Part and move it below the task web part
- Click in the web part, click Edit, Modify Shared Web Part, and in the Appearance section change "Chrome" to "None".
- Click the Source Editor button
- Note that this example assumes that the cell with the link and dropdown list is the second cell in the row (cell 1). i.e. “childNodes”
// for info: http://techtrainingnotes.blogspot.com
var x = document.getElementsByTagName("TD") // find all of the TDs
if (x[i].className=="ms-vb2") //find the TDs styled for lists
var theTargetNode = x[i].parentNode.childNodes
// The following is all one line:
alert('This task has been completed and cannot be edited.')
- Remember to add this to your rebuild / disaster recovery plan documentation!
- Users will be able to get to the task and edit it through a direct URL to the task edit page or through any other views you have not modified.