2

I have followed the answer described in Hide list column on new, edit item-OOTB

But what I found is when editing the column from the content type, i found the hidden menu is disabled.

Content type description :

Content types

Approved field settings :

approved field settings

Why does this problem occur?

4
  • Try it from SharePoint Designer. Also check you have enough permission. Commented Sep 20, 2016 at 6:28
  • trying it from the system account. Commented Sep 20, 2016 at 6:34
  • ohhh!! then try to hide it from designer. Open site in designer --> Click On List/Library --> Click on your list --> Click on content type --> Click on edit content type --> double click on your column Commented Sep 20, 2016 at 6:40
  • surprisingly double click does not work sometime. in that case, you may need multiple click Commented Sep 20, 2016 at 6:53

3 Answers 3

1

It happens for Yes/No (check box) column but it is possible to hide it from SharePoint Designer. Follow below steps to hide from Designer.

  1. Open site in designer
  2. Click On List/Library from left side
  3. Click on your list
  4. Click on edit content type
  5. Click multiple times (may be it is six times) on your column and then you will get your column in edit mode. Now select the option from drop-down menu.
0

Alternative Solution

If you want hide any field from NEW/VIEW/EDIT item Forms. Then you can simply achieve this using SPUtility.js, Its very simple and useful. You can download js file from sputility

Steps:

  1. Edit NEW/VIEW/EDIT item form in SharePoint UI.
  2. Add Script editor web part.

Add the following script in Script editor web part.

<script src="/jquery.min.js" type="text/javascript"></script>
<script src="/sputility.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
SPUtility.HideSPField('FieldNameToHide');  
});
</script>

Ok & Save the page. Now specified field will not be visible.

If you want to Show that field again then you can use,

<script src="/jquery.min.js" type="text/javascript"></script>
<script src="/sputility.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
SPUtility.ShowSPField('FieldNameToShow');
});
</script>

SPUtility.js is a JavaScript library used to make modifications to SharePoint's list forms (NewForm.aspx, DispForm and EditForm.aspx in a survey, custom list or library). It works with SharePoint 2007, 2010, and 2013 (including SharePoint Online / Office 365).

SPUtility.js Documentation

3
  • Is that a good practice to choose coding solution what I can do using default feature? Why should I add an extra library to show/hide a field? Commented Sep 20, 2016 at 6:56
  • @ Atish. Using OOTB way is always a good practice. No doubt. But i already mentioned that this is an alternative solution in case if you cant able to hide it in OOTB way. Also SPUtility is a rich js library that allows us to hide fields based on conditions & Its offers lots of list forms customization. Commented Sep 20, 2016 at 7:07
  • No complain on SPUtility. We should find the actual problem before proposing an alternative, shouldn't we? Commented Sep 20, 2016 at 7:27
0

Here's a little SharePoint PnP function to update a field Hidden setting

function setFieldHidden([string]$inListName,[string]$inContentTypeName,[string]$infieldTitle,[int]$hide1vis0){

$Connection = Get-PnPConnection #assumes you are connected to PnP site.

# Get list content type object
$ListContentType = Get-PnPContentType -list $inListName -Identity $inContentTypeName
$lcFields = Get-PnPProperty -ClientObject $ListContentType -Connection $Connection -Property "Fields" 
foreach($field in $lcFields){

    if($field.Title -eq $infieldTitle){

        $ListContentTypeField = $field
     }
}



$ListContentTypeField

# Code to set content type field hidden
$ListContentType.FieldLinks.GetById($ListContentTypeField.Id).Hidden = $hide1vis0

# Update(UpdateChildren – bool), this value indicates whether the children content type(inheriting from this Content Type) needs to be updated. 0 = False, 1 = True
$ListContentType.Update(0)

$Connection.Context.ExecuteQuery()


}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.