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:
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 ***
<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>
</WebPartPages:ListFormWebPart>
*** 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>
</WebPartPages:ListFormWebPart>
*** 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>
</WebPartPages:ListFormWebPart>NewForm.aspx ControlMode = New
FormType = 8EditForm.aspx ControlMode = Edit
FormType = 6DispForm.aspx ControlMode = Display
FormType = 4 - A way to generate form GUIDs - http://www.somacon.com/p113.php
- 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.
- In the source code in Designer, look for the <WebPartPages:ListFormWebPart ... to </WebPartPages:ListFormWebPart> block of code.
- Copy this block of code and paste it into the broken form overwriting the same block of broken form code.
- Paste the List GUID in <ListName ... between the { and }.
- 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).
- Generate a form GUID (at the link above) and paste it into the ... __WebPartID="{[Form GUID]}" > and the <ID>g_[Form GUID]</ID>.
- Save the file and refresh the list in your browser. The links should now be fixed.


35 comments:
Thank you!!! Your post is brilliant. It made such sense after I read it.
maambeau,
I'm glad I could help. I've had to refer back to this one myself several times!
-Ben
You the man!!!
Awesome post, really helped me out, Cheers.
Really help me!!!!!!!!!
Thank a lot to save my weekend
:)
Awesome Post...Thanks
I resolved Invalid url error for newform.aspx of a list using this poat, now everything is working fine.
But I have a calendar view for this list and now when I click/mouseover on the items in the calendar view they are showing up newform.aspx instead of dispform.aspx. when I mouseover the url I am seeing is /ListName/NewForm.aspx?ID=XXX.
Any comments plzz...
I created the list again from scratch now its working fine...
Hi Ben,
Instead of from the forms, I had link problems from the views. I've customized NewForm, EditForm and DispForm to allow user to create new, edit (with certain permission) and display service requests. The forms work fine except in my views (ex. Createbyme.aspx which shows all requests owned by me). Instead of pointing to my custom DispForm (/[site]/Lists/[list_name]/DispForm_custom.aspx?ID=[request#]), it links to /[site]/?ID=[request#]. I don't think it'd be simple to copy the ListViewWebpart from another non-broken view. Would you share your suggestions for a fix? Thanks so much.
UT
UT,
If you have a copy of SharePoint Designer, you can fix this by
1 - Opening up your site in SPD
2 - Expanding the "Lists" folder
3 - Right-clicking on your list and open "Properties"
4 - Go to the "Supporting Files" tab and make sure that the files you want to do the Editing, Creating (New), and Displaying are specified there.
-Ben
Hi Ben,
Thanks for responding.
I did set "Supporting Files" to my custom forms. The forms (ASPX with ListFormWebPart) work fine except the views (ASPX with ListViewWebPart) kept pointing to wrong links. I didn't change Createbyme.aspx and the date stamp wasn't modified. As open Createbyme.aspx: a) I'd see links to my requests in Design view, b) mouse over the links I saw ?ID=[request#], not [site]/Lists/[list_name]/DispForm_custom.aspx?ID=[request#].
Per your instructions of how to fix broken links in list forms, it was the broken ListFormWebPart that caused problem. In my case, there was ListViewWebPart which is unique in each view. I didn't think it's possible to copy this part from another non-broken view. Do you think I should recreate Createbyme.aspx from scratch?
U,
Instead of recreating the page, try this from the List View page:
1 - Site Actions > Edit Page
2 - On the view Web Part > Edit > Modify Shared Web Part
3 - From the "Selected View" drop-down, select the name of the view that you want to use and click "OK"
This should reset the view to point to the new forms you've created.
-Ben
I've tried and it still didn't work. I then tried to recreate the view, the links still point to ?ID=[request#].
Just a note:
The new form GUID that was generated will need to be adjusted for the entry g_[Form GUID] as follows: the dashes need to be changed to underscores, and the uppercase letters to lowercase letters. (not sure if it will work with the uppercase, i just changed it) If this is not done, you will get Javascript errors.
Took me quite a while to figure out why the People picker (address book) was not working.
"U": Did you ever solve your problem? I had the same issue as you and cannot get the form to "re-locate" my DispForm.
Brilliant; thanks much. Has helped us understand how those properties bubble up for a list.
Hi Guys,
I did same thing as mentioned in above comments..link is ok now, but im getting this ERROR
----------------------------------
No item exists at http://ex07/helpdesk/Lists/servicerequests/DispForm.aspx?ID=135&Source=http://ex07/helpdesk/default.aspx. It may have been deleted or renamed by another user.
Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.
Troubleshoot issues with Windows SharePoint Services.
----------------------------
for the no item exists url issue:
http://praveenbattula.blogspot.com/2010/02/sharepoint-exception-no-item-exists-url.html
THANK YOU THANK YOU THANK YOU!!! This has been driving me nuts for days...the directions in your post worked like a charm!
Fantastic! Helped a ton!
Now that my EditForm.aspx is fixed, any idea why when I edit the form & click do I get an unexpected error that talks about permissions etc?
This was a lifesaver! I was pulling my hair out after doing a very simple edit to the page and spent way too much time trying to get it back to normal (even backing up the files before the edit). Thank you, thank you, thank you!
I had the same problem as UT and following the directions in this post solved the problem. I had to re-read it a couple times and look into the form code to understand what he was talking about but once I understood, it was simple to fix and test.
didn't work for me - looks like I have to recreate the list and I just know I will make the same error all over again and have to recreate the list all over again when I break dispform again.
This is a near fatal error in sharepoint in my eyes. It is unacceptably easy to break SP even using M$ sanctioned techniques and tools.
Thank you for this great post. Really got me out of a tough situation.
Here's a weird one, my list webpart works fine but the Edit link is broken. The link in supporting files is correct. The webpart renders only the ID portion of the link. Any ideas?
I can't believe this worked. SharePoint is honestly the worst web application I'm yet to deal with in my life. So much configuration, so little convention. Everything has been made as complex, verbose and propriety as humanly possible. Not a surprise coming from Microsoft, but god damn, I didn't know it was possible to construct such a crap bit of software.
Just my little vent; it's been building up for the past month.
Just to provide a little further info. I've found that the trick here is simply changing the ID of the web part. This seems to trigger something in SharePoint which corrects the broken link.
Great post, thank you. But I have a slight issue. I know not to delete the default wep part and I haven't done so. I have 3 custom list forms (New, Edit & Display). These link correctly, but if I make another Edit form, the link will always redirect to the default custom Edit form. I have changed the control mode to display and then it takes me to the custom Display form instead. It seems I cannot have more than one custom form for this list, but I have achieved multiple Edit forms only a couple of months ago. Any advice would be greatly appreciated.
Thank you SO much for this! Your directions are awesome, but I somehow managed to mess them up anyway at first, so I thought I'd highlight some things I ran into. :)
Like others above I corrected my forms but the list still didn't link back. This seemed to happen because I skipped some steps thinking I could just copy/paste from a non-corrupted form and be on my way, but that doesn't work.
To make it work you have to after you copy/paste from a non-corrupt form you have to update the following: Webpart ID [FORM GUID here - this is the one you generate from the link provided in the post]
ID g_[FORM GUID here - this is the one you generate from the link provided in the post. Note that you have to reformat it to be all lowercase and change dashes to underscores for this part.]
Control Mode [you have to change this to New, Display or Edit depending on the form you're fixing]
Form Type [you have to change this to 8, 6, or 4 depending on the form you're fixing]
Once you've done all of those things the links to the forms get fixed in the list. I found out that if you try to use the same FORM GUID for every form the forms will re-corrupt so make sure you're getting unique FORM GUIDs for each form. At least that is what ultimately worked for me!
Hi,
I used to be able to fix the broken link with your suggested way, but this time it doesn't work. after all the code changed, and I tried to preview it in the design view, all I have now is WebPartPage:ListFormWebPart-An error has occurred.
How can I debug it? How can I fix it?
Do you know how to do the same but for Sharepoint Team Services (very old sharepoint).
I currently have an erro on "dispform.htm" of a list.
your great post saved me even from this curious problem: http://support.microsoft.com/Default.aspx?id=935504
(MS of course present recreating list as the only resolution... :/ )
thanks!!!
Virtual high five! Thanks for taking the time to write this out. It helped me with my issue and understand the workings of SP that much more.
To fix the broken link on the pages after recreating the dispform/editform/newform.aspx, you have to refresh the links on the whole page. Go to Site-> Recalculate Hyperlinks
Ps. You should have changed the supporting files first if ever you have a different filename of each page.
Still a good post nearly three years later! I was frusterated because I couldn't get it to work after following the instructions. I realized that the listform webpart was also broken on the new item... although it wasn't obvious since the custom page I made worked! I had to add the list form item to the BOTTOM of my custom page - it's not visible live - to make the Display page work?? Crazy but it worked. The listform webpart must work on ALL 3 pages - new, edit & display!
Post a Comment