kwizcom banner advertisement

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

How to Make Attachments Mandatory in SharePoint List? How to Make Attachments Mandatory in SharePoint List? Reviewed by Salaudeen Rajack on 2:08 PM Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.