I have a Custom List Form for Edit Item in a custom aspx page developed using SharePoint Designer. There was a requirement in this. There should be a check for attachments,i.e. attachments should be made mandatory. This had to be achieved through Javascript. The following function helped in achieving the same. Note: This function should be called in the OnSubmit event of the form. Also, don't change the
id "idAttachmentsTable"
function CheckForAttachments()
{
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 ;}
}
Subscribe to:
Post Comments (Atom)
hi, where to attached the above function??
ReplyDeleteI couldnot find on submit event .
Your best bet is to put this in the "function PreSaveAction()" as it's a default function that runs beofre the item saves.
ReplyDelete