0
   

Javascript white space validation

 
 
sijo
 
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
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 3,035 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » Javascript white space validation
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 02/11/2025 at 10:04:09