To hide a field from any of the SharePoint Designer Form we usually create a custom form and edit the code and add a style attribute as style="display:none" in <tr> element.
But what if you do not want to create a custom form and hide the field on the default form? Is it possible? The answer is YES.
You can hide the field on default SPD form via PowerShell command without having to create a custom form.
Open SharePoint Management Shell and type the following commands. The below example hides a field from a NewForm.
You can similarly execute the below command for DisplayForm and EditForm. The only statement you need to change is:
But what if you do not want to create a custom form and hide the field on the default form? Is it possible? The answer is YES.
You can hide the field on default SPD form via PowerShell command without having to create a custom form.
Open SharePoint Management Shell and type the following commands. The below example hides a field from a NewForm.
$web = Get-SPWeb webUrl
$list = $web.Lists.TryGetList("ListName")
if($list)
{
$field = $list.Fields["FieldName"]
$field.ShowInNewForm = $false
$field.Update()
}
$web.Dispose()
You can similarly execute the below command for DisplayForm and EditForm. The only statement you need to change is:
$field.ShowInDisplayForm = $false
$field.ShowInEditForm = $false