none
Hide column in NewForm, EditForm using Powershell

    Question

  • Hi,

    I have a custom list. I have a single line of text column "Road Path" which I want to show in view form only. The column should not be available in NewForm, EditForm. This column is part of multiple content types. I want to hide this column for all content types.

    How to hide the column using powershell in New and Edit Form?

    Thanks

    Friday, June 24, 2016 1:07 PM

Answers

All replies

  • You can do this via SharePoint Designer 2013:

    1. Using account that has at least Design level permissions to the list, launch  instance of SharePoint Designer 2013.
    2. Connect to the site containing the list
    3. In the left Navigation panel, select Lists and Libraries.
    4. At right, on the main activities tab, select the specific list.
    5. On this panel, in the Forms section, click the New button.  The Create New List Form dialog appears.
    6. Enter a name, e.g., cNewItem
    7. For the type of form, select "New item form"
    8. Click OK.  The new form will appear listed in the Forms section.  Note that its Type is New.
    9. Click on this new form.  The new form will open in development view.  Note that some areas are highlighted yellow and others aren't.
    10. Scroll through the items  not highlighted until you find the column "Road Path".  note that it is containing within "TR" fields.
    11. Select everything, and include, from "<tr>" to "</tr>" containing the "Road path" column.
    12. Save the form.  Any changes will be instantly updated to the server.
    13. Repeat all these steps to create a revised Edit form.

    You have to go through this process because only when you create a new instance of the list forms are the column fields explicitly identified in the form markup.  To see this, click on one of the default forms to view it in Development view: note that individual column fields are not shown.  This is because it is automatically generated.

    Friday, June 24, 2016 2:00 PM
  • Hi,

    use the below PS1, change your site URL and column Name

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    #Get the Web
    $SPWeb = Get-SPWeb "http://ptcpasaspapp03/sc2/Engineering/Process"
    #Get the List
    $SPList = $SPWeb.Lists["TestList"]
    #Get the Field
    $SPField = $SPList.Fields["ColumnTest"]
     
    #Hide from NewForm & EditForm
    $SPField.ShowInEditForm = $false
    $SPField.ShowInNewForm  = $false
     
    $SPField.Update()
    $SPWeb.Dispose()


    KRISHANA KUMAR

    SharePoint Architect

    Mosstechnet-kk.com

     

    Please click "Mark As Answer" if this post solves your problem or "Vote As Helpful" if it was useful

    Friday, June 24, 2016 2:14 PM
  • Hi Venkatzeus,

    I agreed with KRISHANA, also you cak check the following article:

    http://www.codeproject.com/Tips/647760/Hiding-SharePoint-list-field-column-from-newform-a

    Please check if the reply helps you. If yes, please mark the replies that help you as answer, it will be beneficial for others who meet the same issue in the future.

    Best Regards,

    Wendy


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Monday, June 27, 2016 3:06 AM
    Moderator