Invoke action upon clicked over item

How to invoke a particular action when user clicks on the any of the following fields for an item in SharePoint document library?

Type (icon linked to document)

Name (licked to document with edit

August 2nd, 2013 4:06pm

Hi,

Because the "Name" field's click event is put in a tag <a>, so we can check to see if the tag <a> with "onclick=" or "href=" attibute in it, then fix it for us.

Here is a code snippet on finding the specific field in a list from this post :

<script>
function DisableLinks()
{
var x = document.getElementsByTagName("A");
for (var i=0;i<x.length;i++)
{
  if (x(i).href.indexOf("DispForm.aspx")>-1)
  {
    x(i).onclick = function () {return false};
    x(i).href = "javascript:return false";
  }
}
}
// add our function to the SharePoint OnLoad event
_spBodyOnLoadFunctionNames.push("DisableLinks"); 
</script>

best regards

Free Windows Admin Tool Kit Click here and download it now
August 5th, 2013 9:53am

Hi Patrick,

Thanks for the response. I'll try this out and get back.

August 6th, 2013 3:16am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics