Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've created a custom edit form, and the attachments functionality is half-broken. When I click the attach button, it takes me to the attach form and I can browse, select a file, and hit OK. That all works, and the file is actually attached. The problem is that it looks like it didn't work, because the attach form just clears the file name field and doesn't redirect back to the form.

Has anyone encountered this before? As far as I can tell, this isn't the usual custom form attachments problem. As I said, I can attach files. It just looks like I can't.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Okay, so after some debugging I found the problem and, even better, the solution.

The OK button on the attach form runs a script called OKAttach(), which features a line towards the end that reads:

document.getElementById("idAttachmentsRow").style.display="";

All well and good, except that at some point SharePoint sneaked behind your back and did this to the attachments row:

<tr id="idAttachmentsRow{generate-id()}">

Which means that there is no row with an id of "idAttachmentsRow" and the script breaks. Simply go in and delete out the generate-id() function and everything's fine again: attachments are attached and you're redirected back to the edit form.

share|improve this answer
add comment

You can also create a new, empty, element with the appropriate id. This also seems to restore the "proper" look and feel.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.