Sharepoint - How to make a Column hidden in SP List Item View?
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.
- The ‘Display Form‘ will be opened in ‘Edit Mode‘ > Add a Web Part > Media and Content > Script Editor.
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
- SHOW / HIDE FIELDS BASED ON CHOICE FIELD SELECTION USING JQUERY IN SHAREPOINT
- SHOW / HIDE FIELDS BASED ON A DROPDOWN SELECTION USING SPUTILITY.JS
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).
- Open SharePoint Designer 2013, and open your site (and log in using user with necessary permissions)
- On the left navigation, click Lists and Libraries
- Click on your custom list
- On the right side, you will find Forms section. Click New -> Display Item Form. Set the name of the form (for example: DisplayForm)
- Click the previously created form (the row, not the form link), then on the toolbar, click Set as Default.
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>
Remove those lines and save the form.
- Go to your list, view one of the item, and the Email Employee column will not be displayed.
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 "";
}