use this function im javascript
<script language="javascript">
function trimAll( strValue ) {
var objRegExp = /(\s)$/;
if(objRegExp.test(strValue)) {
strValue = strValue.replace(objRegExp, '');
if( strValue.length == 0)
return strValue;
}
objRegExp = /(\s)([\W\w])(\b\s$)/;
if(objRegExp.test(strValue)) {
strValue = strValue.replace(objRegExp, '$2');
}
return strValue;
}
document.form1.txtField.value = trimAll(document.form1.txtField.value);
</script>
on the onsubmit method of the form write this function
<script language = "javascript">
function validate(){
if(document.form1.txtField.value == ""){
alert("Please enter value for textarea");
return false;
}
}
</script>