Wednesday, 27 June 2012

Prevent loading of contextual ribbon on click of list view web part in SharePoint 2010

I was facing the same issue and found the solution from here


you need to override the two javascript functions as below on the customized page:
//following functions are added for disabling ribbon menu for list view
<script type="text/javascript">
function WpClick(event)
{
return false;
}
function WpKeyUp(event)
{
return false;
}
</script>

Friday, 22 June 2012

Disable SharePoint People Picker Control


 I got a task to disable/make people picker control column read-only in a SharePoint list editform.aspx page using jQuery. In my scenario, There are two People Picker Control and I need to disable only one.
After spending good amount of time, I got the solution as shown below:
//Load JQuery file
<script type="text/javascript" src="../../jquery/jquery-1.7.1.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {

var columnName = 'Name';
var searchText = RegExp("FieldName=\"" + columnName + "\"", "gi");
$("td.ms-formbody").each(function() {
        if(searchText.test($(this).html())) {        
           $(this).find("div[Title='People Picker']").attr("contentEditable",false);
           $(this).find("a[Title='Check Names']").hide();
           $(this).find("a[Title='Browse']").hide();     
       }
   });
});
</script>