Make attachment required field in SharePoint List/ Library
<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 File");
return false ;
}
else {
return true ;
}
return true ;
}
</script>
--------------------------------------------
If need confirmation box. Please use the below code
function PreSaveAction()
{
var elm = document.getElementById("idAttachmentsTable");
if (elm == null || elm.rows.length == 0)
{
var r=confirm("Do you want to attach the file?");
if(r==true)
{
return false;
}
else
{
return true;
}
}
else
{
return true;
}
return true ;
}
function PreSaveAction()
{
var elm = document.getElementById("idAttachmentsTable");
if (elm == null || elm.rows.length == 0)
{
document.getElementById("idAttachmentsRow").style.display='none';
alert("Please Attach File");
return false ;
}
else {
return true ;
}
return true ;
}
</script>
--------------------------------------------
If need confirmation box. Please use the below code
function PreSaveAction()
{
var elm = document.getElementById("idAttachmentsTable");
if (elm == null || elm.rows.length == 0)
{
var r=confirm("Do you want to attach the file?");
if(r==true)
{
return false;
}
else
{
return true;
}
}
else
{
return true;
}
return true ;
}
Comments
Post a Comment