November 09
Customized Forms and the Attachment Button
In my last
blog, I modified the EditForm page and broke it up into several pages. The problem with this is that any customization to the built-in forms throws an error when you try to use the attachments button on the toolbar. As best as I can tell, it comes from this code (form.js):
function ShowPartAttachment()
{
if (document.getElementById("part1")==null ||
typeof(document.getElementById("part1"))=="undefined")
{
var L_FormMissingPart1_Text= "This form was customized not working with attachement.";
alert(L_FormMissingPart1_Text);
return;
My list needs attachments but adding <SPAN id='part1'> tag in my customized form threw a different error. So I decided to use the NewForm, hide the entire form except attachments and not customized the form. The multi-step edit form will allow users to complete the rest of the form.
To do this, I had to add a new web part zone to the NewForm.aspx page in SharePoint Designer. Then I placed a Content Editor web part in the new zone. Since I didn't touch the standard form, no error. I loaded the page and used the, now visible, Edit Page action to add the following CSS to the Content Editor web part and set the web part to 'hidden':
<style type="text/css">
.ms-formtable tr
{
display:none;
}
#idAttachmentsRow
{
display:inline;
}
#idAttachmentsTable tr
{
display:inline;
}
</style>