Sunday, November 1, 2015

How to Make Attachments Mandatory in SharePoint List

Requirement: In a SharePoint list, make attachment required field!

Solution:
While, creating a Document library with metadata columns is one option, requirement is only to make the attachments mandatory in SharePoint list forms. To make attachment mandatory in SharePoint list we can use simple JavaScript. Add content editor or script editor web part on "NewForm.aspx" just below SharePoint list form web part, and then place the below code in it!

JavaScript to make attachments mandatory:

<script type="text/javascript" language="javascript">

function PreSaveAction() {
if (document.getElementById('idAttachmentsRow').style.display=='none' )
  {
     alert('Attachment is Mandatory! Please attach Documents.');
     return false ;
  }
else {  return true;  }
}
</script>

and here is the script in action:
sharepoint 2013 list attachment mandatory



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...