Вопрос

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

Это было полезно?

Решение

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

Другие советы

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.

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 "";
}

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();

i am using sharepoint 2010. I have a list where I use validation for my columns.

I want to hide field "Contract Extension Reason" when Type of Contract is equal to "Contract Extension"

I tried this but it says, "The formula contains a syntax error or is not supported."

=IF([Type of Contract]<>"Contract Extension",hidefield([Contract Extension Reason])

In addition, I have no full access to sharepoint. I cant even have that VALIDATION SETTING in the setting list>general setting. But i can go there by just changing something in the address.

Need help. thank you!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top