.Net & SharePoint '07

Technical blog for .Net and all SharePoint 2007 related Information

About the author

Me(Prince) and my wife are B.E in I.T & C.S.E respectively.  I a certified MCPD: Web from 2007 Dec. I am Intrestes in Web Application, MOSS, EPM, etc.
Now working with Deira International School, as IT Application & Help Manager. I have started my career as "Software Developer" @  REACH Sewn Technologies and Consulting Pvt. Ltd, Bangalore India from Oct 2004 to Feb 2006, then as "Web & Intranet Developer" @ Fosroc International Ltd, Dubai from April 2006 to Sep 2009.
You can catch me on mail@jpy-tech.com or mail@princepy.com. Or on 00971 - 50 - 4284530 

Google Translate

Tag cloud

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

RecentComments

Comment RSS

Google Your Location


Error message when you try to attach a file in a custom form on the Web site in Windows SharePoint Services 3.0: “This form was customized not working with attachment"

Support: Microsoft KB

"Try it, on your responsibility"

SYMPTOMS

You use Microsoft Office SharePoint Designer 2007 to add a Custom List Form Web Part on a Microsoft Windows SharePoint Services 3.0 site. Then, you try to attach a file by clicking Attach File in the custom form on the Web site. When you do this, you receive the following error message:
This form was customized not working with attachment.

RESOLUTION

To resolve this problem, follow these steps:

Step 1:

Apply hotfix 953749.

For more information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base:
953749(http://support.microsoft.com/kb/953271) Issues that are fixed in Windows SharePoint Services 3.0 by the Windows SharePoint Services 3.0 Infrastructure Update 

Step 2:

Open the List/Document New/Edit Page in SharePoint Designer 2007. Set the Layout to Hidden, and close the Web Part.

To do this, follow these steps:

  1. Right-click the List form Web Part in SharePoint Designer.
  2. Click Web Part Properties, and then click Layout.

  3. In the Layout dialog box, click to select Hidden, and then close the Web Part.

Step 3:

Edit the XSL code in the .aspx page. To do this, follow these steps, as appropriate for your situation.

3.a: In the XSL code block, locate the following code.

<xsl:template name="dvt_1">
    <xsl:variable name="dvt_StyleName">ListForm</xsl:variable>
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
    <table border="0" width="100%">
        <xsl:call-template name="dvt_1.body">
            <xsl:with-param name="Rows" select="$Rows"/>
        </xsl:call-template>
    </table>
</xsl:template>

3.b: Replace the lines of code that you located in step 3a with the following lines of code.

For New Form:

<xsl:template name="dvt_1">
    <xsl:variable name="dvt_StyleName">ListForm</xsl:variable>
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
    <div>
        <span id="part1">
            <table border="0" width="100%">
                <xsl:call-template name="dvt_1.body">
                    <xsl:with-param name="Rows" select="$Rows"/>
                </xsl:call-template>
            </table>
        </span>
        <SharePoint:AttachmentUpload runat="server" ControlMode="New"/>
        <SharePoint:ItemHiddenVersion runat="server" ControlMode="New"/>
    </div>
</xsl:template>

 

For Edit Form:

<xsl:template name="dvt_1">
    <xsl:variable name="dvt_StyleName">ListForm</xsl:variable>
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
    <div>
        <span id="part1">
            <table border="0" width="100%">
                <xsl:call-template name="dvt_1.body">
                    <xsl:with-param name="Rows" select="$Rows"/>
                </xsl:call-template>
            </table>
        </span>
        <SharePoint:AttachmentUpload runat="server" ControlMode="Edit"/>
        <SharePoint:ItemHiddenVersion runat="server" ControlMode="Edit"/>
    </div>
</xsl:template>

3.c: Locate the following line of code.

<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">

3.d: Paste the following code above the line of code that you located in step 3c.

For New Form:

<tr id="idAttachmentsRow">
    <td nowrap="true" valign="top" class="ms-formlabel" width="20%">
        <SharePoint:FieldLabel ControlMode="New" FieldName="Attachments" runat="server"/>
    </td>
    <td valign="top" class="ms-formbody" width="80%">
        <SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="New" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('i','AttachmentsField','Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/>
        <script>
            var elm = document.getElementById("idAttachmentsTable");
            if (elm == null || elm.rows.length == 0)
            document.getElementById("idAttachmentsRow").style.display='none';
        </script>
    </td>
</tr>

For Edit Form:

<tr id="idAttachmentsRow">
    <td nowrap="true" valign="top" class="ms-formlabel" width="20%">
        <SharePoint:FieldLabel ControlMode="Edit" FieldName="Attachments" runat="server"/>
    </td>
    <td valign="top" class="ms-formbody" width="80%">
        <SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="Edit" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('u','AttachmentsField','Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/>
        <script>
            var elm = document.getElementById("idAttachmentsTable");
            if (elm == null || elm.rows.length == 0)
            document.getElementById("idAttachmentsRow").style.display='none';
        </script>
    </td>
</tr>

Note This code sample is for a custom edit item form. If you use a custom new item form, replace ControlMode=”Edit” with ControlMode=”New” in the code.
Additionally, in the __designer:bind attribute, the first parameter for the ddwrtDataBind function should be "'i'" (insert) for a custom new item form and "'u'" (update) for a custom edit item form.
For example, the code may resemble the following code. <SharePoint:FormField runat="server" id="AttachmentsField{$Pos}" ControlMode="New" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('i',concat('AttachmentsField',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/>

3.e: Save the Form.

Notes

  • If you make more changes to the page, SharePoint Designer 2007 may automatically add a unique ID to the attachment code that you added. For example, “<tr id="idAttachmentsRow">” is changed to “<tr id="idAttachmentsRow{generate-id}">.”

This process may cause JavaScript errors on the page. If this issue occurs, delete the “{generate-id}” tags that are added automatically.

 

  • You may receive the following error message:

An unexpected error has occurred

To resolve this issue, move the Custom List form outside the Web Part zone.

  • You receive the following a JavaScript error message:

Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.

If you receive this error message, make sure that the ListForm Web Part that is on the page by default is still there. Then, set the Layout to Hidden, and close the Web Part.
To do this, follow these steps:
1. Right-click the List form Web Part in SharePoint Designer.
2. Click Web Part Properties, and then click Layout.
3. In the Layout dialog box, click to select Hidden, and then close the Web Part.


Posted by Admin on Tuesday, February 03, 2009 1:49 PM
Permalink | Comments (2) | Post RSSRSS comment feed

Comments

Dwight United States

Thursday, November 19, 2009 1:10 PM

I implemented the code as recommended and no longer recieve the error message.  However, the attachment is not saved when I click the OK button.  I do not get an error message or anything...just doesn't save.

Prince U.A.E.

Friday, November 20, 2009 4:48 AM

please try http://support.microsoft.com/kb/953271