SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 4 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:


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

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

Your Answer


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.