5

I have a column called "Employee Email" in a custom list. Is there any option to make the column hidden while viewing the item?

  • 1
    Do you want to hide column from Display Form only ?? – Rohit Waghela Aug 1 '17 at 7:21
  • yes exactly. That is my requirement. – riz123 Aug 1 '17 at 7:26
10

An alternative solution,

You can use Jquery to hide a column in display form by doing the following:

  • In ‘All items’ Page, > From the above ribbon, > In ‘Customize List’ Section > Click on ‘Form Web Parts’ > Select Default Edit Form.

enter image description here

  • The ‘Display Form‘ will be opened in ‘Edit Mode‘ > Add a Web Part > Media and Content > Script Editor.

enter image description here

Add the below code.

<script src="http://code.jquery.com/jquery-1.7.2.min.js" type=text/javascript></script>
<script type="text/javascript">
$(document).ready(function(){
$('nobr:contains("your field name")').closest('tr').hide();
});
</script>

For more details check

  • Use Internal Name of column instead of the Title to hide exact column.. Using Title of column can cause hide multiple column also having same title of two columns.. Syntax for it is : $('[id^="InternalNameOfColumn"]').closest('tr').hide(); – SID Aug 23 '17 at 11:12
6

Yes you can. You could create a new DisplayForm for the List inside SharePoint Designer, and remove unnecessary fields (in this case, the "Employee Email" field).

  1. Open SharePoint Designer 2013, and open your site (and log in using user with necessary permissions)
  2. On the left navigation, click Lists and Libraries
  3. Click on your custom list
  4. On the right side, you will find Forms section. Click New -> Display Item Form. Set the name of the form (for example: DisplayForm)
  5. Click the previously created form (the row, not the form link), then on the toolbar, click Set as Default.

Click the form row

Set as Default

  1. Open the form by clicking the DisplayForm.aspx text (click Yes if you are asked about opening the form in advanced mode). Find the following scripts (usually placed above <tr id="idAttachmentsRow">) based on your column name, of course:

    <tr> <td width="190px" valign="top" class="ms-formlabel"> <H3 class="ms-standardheader"> <nobr>Email Employee</nobr> </H3> </td> <td width="400px" valign="top" class="ms-formbody"> <xsl:value-of select="@Email_x0020_Employee"/> </td> </tr>

  2. Remove those lines and save the form.

  3. Go to your list, view one of the item, and the Email Employee column will not be displayed.
5

You can also use SharePoint CSR (Client Side Rendering) to hide the field.

Refer below code:

Here Employee_x0020_Email will be internal name of the field you want to hide.

(function () {

    var overrideCtx = {};
    overrideCtx.Templates = {};
    overrideCtx.Templates.Fields = {
        "Employee_x0020_Email": {       
            "DisplayForm": hideField,
        }
    };

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
})();

function hideField(ctx) {

    var span = $get(ctx.FormUniqueId + ctx.FormContext.listAttributes.Id + ctx.CurrentFieldSchema.Name);
    span.parentNode.parentNode.setAttribute("style", "display:none");
    return "";
}
0

you can hide sharepoint list columns easily using power shell

$SPWeb = Get-SPWeb "http://spsite.com";
$SPList = $SPWeb.Lists["ListName"];
$SPField = $SPList.Fields["ColumnName"];

# to hide from EditForm
$SPField.ShowInEditForm = $false;
# to hide from NewForm 
$SPField.ShowInNewForm  = $false;
# to hide from DisplayForm 
$SPField.ShowInDisplayForm = $false;

$SPField.Update();
$SPWeb.Dispose();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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