Reply
Thu 8 Dec, 2011 10:53 pm
I am looking for a script to check my input attachment for a sharepoint form for blank space. Here is my code but it doesnt work properly.
<script type="text/javascript">
function PreSaveAction()
{
var attachment;
var filename="";
var fileNameSpecialCharacters = new RegExp("\\s", "g");
try {
attachment = document.getElementById("idAttachmentsTable").getElementsByTagName("span")[0].firstChild;
filename = attachment.data;
}
catch (e) {
}
if (fileNameSpecialCharacters.test(filename)) {
alert("Please remove white Space.");
return false;
}
else {
return true;
}
} </script>
can you please tell me whats going wrong
BR
Sijo