Forum Discussion
Modern Library - Not able to Customize NewForm.aspx
Anybody come up with a solution for this yet? I don't even want to do anything complex...just hide/show various fields on the new/edit form and on the display form.
Also, doing this in GCC, so PowerApps isn't even on the table.
I tried using PowerShell to leverage SetShowIn___Form($false/$true). It sort of works, however, it appears that in the modern UI everything is an “EditForm”. So your New/Edit/Display forms are always identical based on the $true/$false for SetShowInEditForm() (using PnPPowerShell).
Does anyone have any other ideas on having a different new/edit form than I do a view form?
- Robin NilssonMar 20, 2019Bronze Contributor
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- BenSteginkMar 21, 2019Iron Contributor
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.