Fix for the Custom Form Attachments Issue
In my first blog post called Displaying SharePoint Fields by Permission level, I made a side note that said
Also, I’d like to note that when using custom forms like this, the Attachment button doesn’t work anymore. I think there are blogs somewhere about this bug, but I’ve never tried fixing it.
Well, Microsoft finally has a fix for this. So, apparently, as long as you do have the infrastructure update installed on your servers, and your SharePoint Designer is at SP1 level, you can install the following fix:
The following is the email directly from Microsoft about where to get the fix, and how to apply it:
This is the client side fix:
The server side fix you already have installed but that is the WSS 3.0 Infrastructure Update.
Download this and update your SPD. This will place the code needed to make attachment functionality work for new and edit forms.
For Display forms only, you need to add this:
- Open SharePoint Designer 2007. Go to File | Open Site and connect to SharePoint site.
- Expand out Lists -> [List Name] -> open DispForm.aspx .
- Highlight normal list form by clicking on it. This will select the entire web part.
- Right-click on selected web part, and choose Web Part Properties…
- Expand [+] Layout, check option for Hidden, click OK.
- With web part still highlighted, hit the right-arrow key once. Hit Enter. This creates some whitespace to insert.
- Go to File | Insert SharePoint Controls | Custom List Form…
- Select appropriate list or library, content type, and type of form to create. Click OK.
- Put cursor in the “Expires” table cell, right-click | Insert | Row below. There should now be a new table row with two column cells.
- Put cursor in the left table cell of the new row, type “Attachments”.
- Put cursor in the right table cell of the new row, go to Code view, and paste the following code:
<SharePoint:AttachmentsField ControlMode=”Display” FieldName=”Attachments” runat=”server” Visible=”true”/>
- Save page.
In summary, in SharePoint Designer, when you insert a custom form (DVWP) to create your own custom EditForm.aspx, DispForm.aspx, and NewForm.aspx, the attachment functionality won’t break anymore.