Customizing EditForm.aspx in a Publishing site

After recently doing a lot of work heavily customizing NewForm.aspx and EditForm.aspx for a SharePoint list, I ran into a major issue after I moved my list into a publishing site. The issue appeared when I added a webpart onto my EditForm.


As soon as another webpart was added, the entire page switched into some sort of weird publishing mode.


This new mode has a couple of changes to the form:

  1. A publishing toolbar now appears at the top
  2. Every field in the List View Web Part has an additional “form” label
  3. Additional JavaScript is added to the page that prompts the user to save whenever an attempts to navigate somewhere differently: To save your changes before continuing, click “OK”. To continue without saving changes, click “Cancel”.

In my case, this new mode definitely would not work for what I was trying to do. The labels increase the size of the form dramatically, the publishing toolbar makes it seem as if you are editing the page rather than a list item, and this new mode does NOT appear on NewForm.aspx which means the forms are dramatically inconsistent.

After googling, I found a couple of people who have had similar issues. The root cause seems to be the Office SharePoint Server Publishing site feature. Since disabling the feature on the site was not an option, I had to find another way. JavaScript and CSS was a viable option (since I’m customizing the form using these anyway) but I felt like I needed a more bullet proof method.

My method involves using SharePoint Designer to customize EditForm.aspx. (Updated January 13th, 2011 after ADE’s comment below. Thanks a lot!)

Step 1: Create a new custom EditForm.aspx by right clicking on EditForm.aspx, click “New From Existing Page”


Step 2: Add the SPNavigation line in right before PlaceHolder Main:

ContentPlaceHolderId="PlaceHolderLeftNavBar" runat="server"/>
ContentPlaceHolderId="SPNavigation" runat="server"/>
ContentPlaceHolderId="PlaceHolderMain" runat="server">

Step 3: Save your new CustomEdit.aspx into the same directory as EditForm.aspx

Step 4: Verify your list now is associated with your new CustomEdit.aspx by right clicking on the list in SharePoint Designer and clicking “Properties”.

Your new edit form should be listed under the Supporting Files tab for Edit item form: