Forum Discussion
Modern Library - Not able to Customize NewForm.aspx
BenStegink I just tried this on a test modern list and it worked. I had to wait 10-15 minutes before the field actually disappeared from the form.
This test was to remove a field from the New Form. It used the PnP library. If you haven't used that before, you'll need to install it
Install-Module -Name SharePointPnPPowerShellOnline
Change the TENANTNAME, SITENAME, LISTDISPLAYNAME, FIELDINTERNALNAME
$cred = Get-Credential
Connect-PnPOnline -Url https://TENANTNAME.sharepoint.com/sites/SITENAME -credential $cred
$processedField = Get-PnPField -List "LISTDISPLAYNAME" | Where {$_.InternalName -eq "INTERNALFIELDNAME"}
#SetShowInDisplayForm
#SetShowInEditForm
$processedField.SetShowInNewForm($false)
$processedField.Update();
Invoke-PnPQuery
Disconnect-PnPOnline
Robin Nilsson Thanks, I was using the method you outlined already, I just needed to do little more testing. I was changing too many properties at once when I was originally testing. The New/Edit does appear to work, however, the Edit/Display is where it all falls apart. I took the time to go through all the configurations and this is what you get
Essentially, Display follows along with the Edit property rather than the Display. I'm assuming this is due to the quick edit in the information pane. But what would make sense it to only show the "Display" fields in the information pane, and the "Edit" fields once you click "Edit All". So, when dealing with Modern UI, you really only have New and Edit. Display is just ignored
Also, I realized one of the fields I was using was a calculated column. Those actually just ignore all the rules and won't show at all.
You could maybe make the argument that you don't need Display, as you can display everything you need in the list view and should only click on the info panel if you need to make a change. This may be the route I try. However, there are also times when you want a set of the fields in the list view for sorting/filtering/grouping but don't want to show all the fields. Once someone finds the list item they are looking for, they should be able to click it to view all the fields but not be able to change specific fields. Right now that doesn't seem to be possible with the built-in functionality in the modern UI.
- Robin NilssonMar 21, 2019Bronze ContributorGreat work! I confirm your analysis on Display form not acting as expected when using the .SetShowInDisplayForm property of a field. I'd consider that a bug, actually - if there's a reason to not display something, it should be honored. I don't train much on using the info panel - I'm torn by its ease of use. But if a list uses PowerApps to interact with a list, the info panel is a way to get around any processing the PowerApps might do, which could cause problems.
Calculated fields have always been like that in SharePoint - only available on the Display Form. When I've needed to show it on an edit form I used customization to pull the field value and display it.- BenSteginkMar 21, 2019Iron Contributor
Robin Nilsson, Yeah, I was going to use PowerApps, but it's a GCC tenant (which doesn't have PowerApps yet, it's been delayed at least 6 months beyond when it was supposed to be available...another story...)
As for calculated fields, agree, it makes sense it shouldn't be on New/Edit since it's calculated. It just doesn't show on Display either...probably due to the face that Display appears to be driven off the Edit property.
Thanks Robin!
Ben