Monday, 20 April 2015

How to make attachment mandatory in SharePoint list form?

Using a list item it is not possible to make the attachment required out of the box. To make this field mandatory we will need to add JavaScript on list form.

Below is the java script which will make attachment field mandatory on list form


<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>


Hope this helps.

Ref: https://social.technet.microsoft.com/Forums/sharepoint/en-US/c93d7611-f634-4c03-ae0d-3b5ecfe5ca6a/how-to-make-attachment-required-field


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...