sharepeoint list Newform.aspx needs to check before saving the item, for that i wrote a PreSaveAction funtion using javascript. right now i’m checking the expiration date with current date before saving the item and it looks like this
function PreSaveAction() { var a1=...... var a2=..... if (a1<=a2){ return true; } else { window.location.href= "redirection.aspx"; return false;}
now i need to add something to this to check the attachments (to make the attachments required) to the newform.aspx for that
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 ;} }
i need to combine both the codes above in PreSaveAction function, so it should check the attachments first then check the expiration date.
Thanks in advance.