Friday, August 13, 2010

Recover broken sharepoint list forms NewForm.aspx,EditForm.aspx.

If you've ever played around with any of the SharePoint list forms (NewForm.aspx, EditForm.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 similar problem in last month. I was spend around 1 day to re-correct that page, but no output. Luckily there's an easy way to fix this, its take hardly 5 min.


Here are the things you'll need to fix your forms:

  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.
  2. Remove ListFormWebpart from broken page  "<WebPartPages:ListFormWebPart ... to</WebPartPages:ListFormWebPart>"
  3. Copy ListFormWebPart from unbroken list page open in previous and paste it into the broken form.
  4. Paste the List GUID in &ltListName ... between the { and }.
  5. Generate a form GUID from Visual Studio or click on http://www.somacon.com/p113.php to generate GUID and paste it into the ... __WebPartID="{[Form GUID]}" > and the <ID>g_[Form GUID]</ID>.
  6. Save the page and refresh the list in your browser. The page should now be fixed.

5 comments:

  1. I've found an easier solution.
    1. Navigate to the list in SP Designer.
    2. In the "Forms" Group click on "New" on the right of the groups title menu.
    3. Give it a name and select the type of form you want to re-create. (New, Edit or Display)
    4. Check the "Set as default form for the selected type" box
    5. press OK

    ReplyDelete
    Replies
    1. Plus 1 for anon!!!!

      Delete
    2. Plus 2 for anon, thank you for being awesome!

      Delete
    3. This creates a custom new or edit form, not the original type which adapts the fields automatically as you add / remove / reorder.

      Delete
  2. This is an awesome post. It's great to know the ins and outs out XSLT, but here's an even easier way...

    Simply delete the bad form and make a copy of one of your good forms and name it whatever the bad form was.

    ReplyDelete