If you’ve ever played around with any of the SharePoint list forms (NewForm.aspx, EditForm.aspx, or DispForm.aspx) in SharePoint Designer, then you may (probably) have been faced with broken links and a host of other errors that have rendered your forms, and quite probably your list, useless.

I faced a similar quandry late last week. A form that I had done some work on broke and my backup plan of deleting the broken form and copy/pasting the original form back also failed. Come to find out that rather than looking for file names like every other webserver in existence, SharePoint works on a GUID system. I’m not 100% on how it works exactly, but I know that it does.

So faced with the prospect of having to migrate the list data (LOTS of it) to a new list in order to fix the broken form, I decided that it would be a much better path to learn how to fix the GUIDs.

The Challenge – Fix broken forms on a SharePoint list.

The Problem – SharePoint operates on a GUID system rather than a file name system so simply replacing the broken file with a backup file won’t work since SharePoint will look for a file with the proper GUID, not just the proper file name.

The Solution – Luckily there’s an easy way to fix this, but it takes a bit of digging. I’m going to assume that you’re already a bit familiar with SharePoint designer and the file structure of a list since (to my knowledge) the only way to break a form is from within Designer. Here are the things you’ll need to fix your forms:

  • The list GUID for the forms – there are two quick ways you can get this: 1) Sort the list in your browser and copy the GUID between ?View={ and }, or 2) copy it from one of the other (unbroken) list forms.
  • The proper XML info for the form which is below:
*** NewForm.aspx ***
<WebPartPages:ListFormWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{[Form GUID]}" >
<Title>TITLE HERE</Title>
<ID>g_[Form GUID]</ID>
<ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">{[LIST GUID]}</ListName>
<ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">New</ControlMode>
<FormType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">8</FormType>

*** EditForm.aspx ***
<WebPartPages:ListFormWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{[Form GUID]}" >
<Title>TITLE HERE</Title>
<ID>g_[Form GUID]</ID>
<ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">{[LIST GUID]}</ListName>
<ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">Edit</ControlMode>
<FormType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">6</FormType>

*** DispForm.aspx ***
<WebPartPages:ListFormWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{[Form GUID]}" >
<Title>TITLE HERE</Title>
<ID>g_[Form GUID]</ID>
<ListName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">{[LIST GUID]}</ListName>
<ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">Display</ControlMode>
<FormType xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">4</FormType>

    • I stripped this XML code down to the critical parts. There is a LOT more that you’ll see when you try to edit the ListFormWebPart, but these lines are the ones that are relevant to the topic at hand. To cut through the code even more: 
      NewForm.aspx ControlMode = New
      FormType = 8
      EditForm.aspx ControlMode = Edit
      FormType = 6
      DispForm.aspx ControlMode = Display
      FormType = 4



Now that you have all the tools to make this thing work, here’s how you do it:

  1. With the broken form page already open in SharePoint Designer, open any form that is NOT broken. This can be any form from from any list as long as it works, but it is easier if this form comes from the same list as the one you’re trying to fix.
  2. In the source code in Designer, look for the <WebPartPages:ListFormWebPart ... to </WebPartPages:ListFormWebPart> block of code.
  3. Copy this block of code and paste it into the broken form overwriting the same block of broken form code.
  4. Paste the List GUID in &ltListName ... between the { and }.
  5. Make sure that the other XML data is correct based on the form that you’re trying to fix (this is taken from the table above).
  6. Generate a form GUID (at the link above) and paste it into the … __WebPartID="{[Form GUID]}" > and the <ID>g_[Form GUID]</ID>.
  7. Save the file and refresh the list in your browser. The links should now be fixed.

Source : http://moblog.bradleyit.com/2008/10/broken-sharepoint-list-forms.html

Show Buttons
Hide Buttons

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.