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
Technology Tips and News
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
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
Hi Patrick,
Thanks for the response. I'll try this out and get back.