How to Enable Attachment Field in Custom Form in SharePoint



If you use SharePoint Designer 2007 to add a Custom List Form Web Part SharePoint site, perhaps you noticed that while trying to attach a file by clicking Attach File in the custom form on the Web site you get the error message "This form was customized not working with attachment". In this article I am showing a way to use the attachment option in a custom list form.

Once you are done with the custom form with SharePoint Designer, 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>



Find the tag as shown below:

AttaShare1.gif

Replace the lines of code that you located in step 2a with the following lines of code:

<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>

Once you have done that you will get the Attachment option:

AttaShare2.gif
 

Up Next
    Ebook Download
    View all
    Learn
    View all