How to make attachment required field?
We would like to create a custom list and require user to attach a scanned form. How do we make the attachment a required field? Also, when creating new column, there is no column for attachment type. Is it possible to attache multiple files to a record? Thanks.
July 30th, 2008 5:52pm

I don't think you make an attachment mandatory through the user interface.You may be able to use an event receiver (requires code) or use infopath.--Paul Galvin of www.Conchango.com @ http://feeds.feedburner.com/PaulGalvinsSharepointSpace
Free Windows Admin Tool Kit Click here and download it now
July 30th, 2008 7:30pm

the supported method would be to use a document library, so as the scanned files are uploaded you then tag them.Using a list item it is not possible to make the attachment required out of the box. We have written JScript to do this in the past. The attachments names are stored in a hidden DIV in the New Item form. It is easy to check if anything has been added to the DIV. You can also check the file type extensions being used in this DIV. You just need to place your JScript code in a Content Editor Web Part.Not the best solution, but it will do the trick.Regards,James.
July 31st, 2008 12:23am

<script type="text/javascript" language="javascript"> function PreSaveAction() { var elm = document.getElementById("idAttachmentsTable"); if (elm == null || elm.rows.length == 0) { document.getElementById("idAttachmentsRow").style.display='none'; alert("Please attach Documents"); return false ; } else { return true ;} } </script>
Free Windows Admin Tool Kit Click here and download it now
December 23rd, 2009 8:50pm

This is almost exactly what I was looking for as well. Thank you. Is there a way to add this to a list containing two separate content types? My list captures requests and has two content types - one for individual requests and one for bulk requests. I'd like to have the form require an attachment only for the bulk request - but this seems to act on the list level irregardless of which form is displayed.
January 1st, 2010 7:44am

My last post was not so clear. Is there a way to limit this content editor web part script to a specific content type? Something along the lines of "Where ContentTypeID= xxx..." ? I'm trying to get this script only to run with one of two content types on my list. Or is my only alternative to create a separate newform.aspx page for each content type?
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2010 7:07pm

Thanks Hallelajuh, Your script works excellent. Regards, Suresh Kumar Udatha.
April 7th, 2010 8:22am

Hallelajuh: Please do not propose your own posts as answers. It isn't helpful. Propose the good answers of other people and wait for someone else to propose your posts. (Moderator)FAQ sites: (SP 2010) http://wssv4faq.mindsharp.com; (v3) http://wssv3faq.mindsharp.com and (WSS 2.0) http://wssv2faq.mindsharp.com Complete Book Lists (incl. foreign language) on each site.
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2010 8:43am

Hi Hallelajuh please explain where this code should be added?
May 11th, 2010 7:02am

This code worked for me. Aysha, to add the code follow the steps below; 1. Add a Content Editor Web Part at the bottom of the form ( You might need to do this in SPD). 2. Click Source Editor Button and place the coding.
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2010 11:39am

Hi - I'm not a developer, however, this is exactly what I'm trying to do. I was able to performthe 2 steps indicated above, however, I am still able to add items to my list without attachments. It's probably something small I am missing. Thanks for the help!
June 14th, 2011 4:57pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics