Hello,
I'm trying to use a preSaveAction to make attachments a mandatory field when submitting a new row onto a list in SharePoint. (for whatever reason, employer doesn't allow rules in InfoPath). So I have a javascript function that isn't work (that I didn't write) to lookup the attachment count and then do an If function to make sure it is larger than 0. I'm a novice when it comes to JS, and would like some input... As it's not my script, I don't want to post the whole thing, so just let me know if either of these 2 things look blatantly wrong:
// Get Attachment Count
var AttachmentCount = $("#idAttachmentsTable");
and
// Ensure file is Attached
if (AttachmentCount == null || AttachmentCount.rows == null || AttachmentCount.rows.length == 0)
Many thanks.
EDIT: To clarify, the presavefunction is constantly returning a false, even when there is an attachment. This leads me to believe that the actual lookup must be wrong (constantly returning a 0), since it seems it every other part of this script is doing it's part.