0

How can I hide Columns in New/Edit Form for contributors. Is there a option to do that. I'm using SP 2013 online & SP Designer.

Sandmann2111
  • 17
  • 1
  • 8

2 Answers2

0

With the help of "SPServices" you can get the current user name . Add the users you want to hide a column in specific group. If the current user present in particular group hide the field using jQuery.

Add Content editor webpart in Newform/Editform.aspx and place the below script

<script type="text/javascript" src="/sites/test/Script/jquery.min.js"></script>
<script type="text/javascript" src="/sites/test/Script/jquery.SPServices.min.js">
</script>

<script language="javascript" type="text/javascript">
$(document).ready(function()
{
$().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function (xData, Status) {
var xml = xData.responseXML.xml;
if(xml.search('SharePoint Group') != -1)
{

$('nobr:contains("Column to hide")').closest('tr').hide();

}
}
});
});
</script>
Sabitha S
  • 339
  • 1
  • 6
0

There are ways to do, basic option would be designing form using infopath.You can also do it by Client Side Rendering (JS link) for better understanding go through this blog

https://code.msdn.microsoft.com/office/CSR-code-samples-11-Fully-54ebcaa6

There are lots of blog for CSR to learn

Client-Side Rendering/JS Link documentation?

Rishabh Shukla
  • 508
  • 1
  • 7
  • 15