Quantcast
Channel: Coello GroupCoello Group » SharePoint 2010 Wiki Pages
Viewing all articles
Browse latest Browse all 3

SharePoint 2010 List – Require File Attachment

0
0

While working with a custom list the other day I had the task of requiring file attachments to a custom list item. I know what you’re thinking, just create a document library with metadata. This was a little different however in that not every list item needed a file attachment, it was only list items that had specific options chosen via a radio button choice field that was one of the list columns.

So, how did I do it? It actually didn’t turn out to be too hard with a content editor web part and some JQuery inside of SharePoint Designer. I opened up the list I had this requirement on and then opened up both the NewForm.aspx and EditForm.aspx page. Then, in order to not break those pages from their site definitions, I added a content editor web part on the page so I could drop in some JQuery.

Here is the JQuery I used to accomplish it (you can download the script here):

The PreSaveAction() will run by default whenever someone clicks “Save” on a SharePoint list. The first part of the function just checks to see if certain radio boxes are check and sets a variable. The second part will check for the variable and any list attachments and pop up an alert if the requirements aren’t met. The return false will cause the list item not to be saved and insure that the user either attaches a file or must cancel their list item

ref: http://www.sharepointben.com/blog/Lists/Posts/Post.aspx?ID=627


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images