TRUNK-2280: Latest changes made for displaying a user friendly error message when number of characters exceed 1024

All you need is 
if( object.value.length > maxLength){
.....disable save button
.....show error message
} else{
..... hide error message
..... enable save button
}

You don't need to trim the value.