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.

2 Answers 2


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:


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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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