PDA

Click to See Complete Forum and Search --> : Text Box Validation


Mark Sreeves
Mar 2nd, 2001, 03:08 AM
This will trim the leading and trailing spaces. You can then check the length != 0

<script language="JavaScript"><!--


function trim(strText) {
// this will get rid of leading spaces
while (strText.substring(0,1) == ' ')
strText = strText.substring(1, strText.length);

// this will get rid of trailing spaces
while (strText.substring(strText.length-1,strText.length) == ' ')
strText = strText.substring(0, strText.length-1);

return strText;
}


//--></script>




The script came from here: http://developer.irt.org/script/1310.htm