views:

346

answers:

2

Basically, I need to customise the NewForm.aspx page for a SharePoint list. I also need to have the attachment functionality carry on working. The target environment doesn't have the necessary updates applied to make this just work (and it appears unlikely that this will change. Words can't express how frustrating this is :-( )

Does anyone know how to work around this so that attachments will work on a customised form? Is it possible? Any suggestions welcome. Everything i've found so far acknowledges the problem but doesn't offer a solution that works other than apply the updates.

Update: Using jQuery to move the appropriate elements from the hidden form into the customised form, I have overcome the initial javascript error to do with the form elements being hidden or of a type that do not accept focus. The form now gives the appearance of working but if you click OK to save to the list, the attachment is not saved. Is there any way round this?

Thanks in advance

A: 

This page has a potential workaround that doesn't involve applying any updates. You should be able to handle everything through SharePoint Designer: http://msmvps.com/blogs/obts/archive/2007/04/14/802759.aspx

Alison
This blog post is a pretty dangerous time trap, as 1) it never worked 2) you don't realize until the end that the bug goes much deeper than the missing tags. The SPDataSource object is also broken which means that even after adding all tags, you still don't get your attachments back
Panagiotis Kanavos
+1  A: 

In short, there is no way to fix the bug without installing some updates, although one of them can be installed "silently". The alternative is to give up Sharepoint Designer and use custom templates.

First, the post pointed by Alison doesn't work, although the author never bothered removing it. It's not just that a customized form lacks the proper tags, the SPDataSource object it uses is also broken and never stores the attachment data, even after you add the missing tags.

A usable workaround came out of MS Support in April 2008 and is described by Marc Davis in this post. The post contains a link to a replacement SPDataSource dll. Without it you will not be able to fix the bug.

This bug was eventually fixed in December 2008 with a standalone hotfix. This was finally rolled up in the December 2008 Cumulative Update.

Obviously, even the workaround requires that Temple installs some additional binaries. The only alternative is to give up on customizing forms by using Sharepoint Designer and create custom templates. A custom template is essentially an ASCX control, which allows you to use all traditional ASP.NET techniques to achieve the result you want. It does need a bit of work to get it working though.

Panagiotis Kanavos