I was so lucky = to receive this error. It may be a bug in Sharepoint (Designer) or I may be the only one that has this problem. I hope you don’t have this “bug”, for them who have the same problem, here is the solution:

I was working on another custom page of EditForm.aspx, I have a DataForm Webpart on  the page showing me the data the way I want it. On that Dataview I have a few text fields and also a Yes/No field. I wanted the user to only see this yes/no field and not edit it.

So I go to the page with Sharepoint designer and select the field and in the properties setting the attribute ControlMode from “Edit” to “Display”. This worked fine in SPD but when I did go to the EditForm in Sharepoint I was getting the following error “An unexpected error has occurred”.  There was not much else I could change or try to resolve this. There isn’t just a property or value that needs to be set to get this working.

The ONLY way to make the page display the way you want in Sharepoint is the next one:

Go to the page in sharepoint designer, the current state of the field isn’t important. Click on the Yes/No field in the design view. Click on the arrow next to the selected field and change format to Boolean. You now see a Yes or No on the page. When you are in split view you can see a <xsl: when … /xsl:otherwise>. In this code you can change the black Yes and No between the tags to a yes and no in your preferred language. In my case that would make Yes -> Ja and No -> Nee.

The code will look like this:

<xsl:when test=”@Klant_x0020_geinformeerd=’1′ or msxsl:string-compare(string(@Klant_x0020_geinformeerd),’Yes’,”,’i’)=0 or msxsl:string-compare(string(@Klant_x0020_geinformeerd),’True’,”,’i’)=0″>Ja</xsl:when>

    <xsl:when test="@YesNoField='1' or msxsl:string-compare(string(@YesNoField),'Yes','','i')=0 or msxsl:string-compare(string(@YesNoField),'True','','i')=0">Ja</xsl:when>



Save, go to Sharepoint and enjoy your working form.

A few days ago I started making a custom NewForm.aspx for a list with Sharepoint Designer. I started hiding the default list form webpart and inserted a custom list form. I tweaked this the way I wanted and it worked like charm. But, with testing I found out that I couldn’t upload any attachments. When I clicked the “Attach File” button nothing happens.

I debugged the javascript that was behind the “Attach File” button. There I found the following piece of code:

function ShowPartAttachment()
 if (document.getElementById("part1")==null ||
 var L_FormMissingPart1_Text= "This form was customized not working with attachement.";

You can see that it tries to hide part1 and shows partAttachment. In my source I found both spans, but the part1 span was holding the hidden listview webpart that was off course already hidden. This is just another bug in Sharepoint Designer.

I started searching the internet for a fix to this problem and came along a post that refers to the following hotfix for sharepoint designer http://support.microsoft.com/kb/960311 and WSS update http://support.microsoft.com/kb/951695. After applying these fixes, I recreated the custom listview. You can also manually edit an existing custom listview by applying a few lines of code that is given here http://support.microsoft.com/default.aspx?scid=kb;en-us;953271&sd=rss&spid=11373, but I recommend deleting and recreating the listview.

This however didn’t solve anything. When I looked a bit closer at the code I saw that the “part1” span was in place and it theoratically should work. After spending some hours to solve this problem I tried to delete the hidden listview, cause I thought it might interfere, and it did! It’s quite obvious because two spans with the id “part1” are on the page and it hides the first one.

We are working with Sharepoint and one typical Sharepoint issue is that when one problem is solved the next pops up. And indeed this is the case. The form worked fine when I did go to AllItems.aspx, but it now throws an error when clicking “New” in the list overview saying “Invalid page URL” and some users getting “An unexpected error has occurred”. The solution is fairly simple: just don’t delete the List Form Web Part, but I did already =|. So I copied the List Form Web Part from a backup back to the site. If you ran into the same situation but don’t have a backup, don’t bother inserting a new List Form Web Part but just copy it from your EditForm.aspx and doing some small modifications. Here are the instructions for doing this: http://blogs.msdn.com/dszabo/archive/2007/02/20/custom-list-newform-aspx-ruined-in-wss-3-0.aspx

Now when I was back where I started I just moved the custom Listview to the top by dragging and dropping in Sharepoint Designer making it the first webpart on the screen. This did solve allmost everything, I could open the new form normally and upload attachments to it.

However as I said before, when one problem is solved the next pops up. Now, when I fill the form and save it I get a brand new error:

“Failed to get value of the “Attachments” column from the “Attachments” field type control. See details in log. Exception message: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)”

The attachments of the two webparts are conflicting so I made the compiler convince that the hidden List Form isn’t a ListForm by edit the following line in the NewForm.aspx in sharepoint designer:

<TemplateName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">ListForm</TemplateName>


<TemplateName xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">NoListForm</TemplateName>

this way the hidden List Form is still there but doesn’t conflict. The form works perfectly fine for me now.


I found out that for the first new item in the list I cannot attach any files, because there is no “attach file” button. For any other new item it worked, but simply not the first one =S

However, there is a solution to this also. Just change the following in the NewForm.aspx and everything will work fine:

<ControlMode xmlns="http://schemas.microsoft.com/WebPart/v2/ListForm">Edit</ControlMode>


<ControlMode xmlns=”http://schemas.microsoft.com/WebPart/v2/ListForm”>Display</ControlMode>

Another update:

Some readers had a problem which is described as “When I try to add attachments to an existing list entry (Edit form) the file attachment dialog doesn’t close when hitting OK.”or “When i click the button to “Attach File”, I now get to the page where I can attach a file, however, after selecting a file when I click “Ok”, nothing happens and I get an “Error On Page” ”

Now one of my readers came with a solution to this problem. When you click on the “OK” button of the attach dialouge after selecting a file, a javascript action occurs, where it takes your selected file and adds it to a table with ID= “idAttachmentsRow”. Now, if this table does not exist, then you will get a javascript error on the page. The reason this table doesnt exist for you is because you have modified your custom new/edit form in the past and deleted your attachments form field. Without the attachments form field you cannot complete the attachment use case. I think the following code will help you (it is tailored for edit forms, but a few small changes it will work for new forms as well)

var elm = document.getElementById(“idAttachmentsTable”);
if (elm == null || elm.rows.length == 0)


Just make a new page. in the new page, add a custom list form. Look at the code generated for the custom list form. At the bottom, it will have your attachments field that you are probably missing. Copy and paste that attachments field into your problem form and you should be good to go.

Credits go to pete w for these solutions.