title: Trim spaces from form input?
body: <p>Hello so i'm trying to trim the white spaces when the user enter spaces he get an error explaning that he should enter valid chars but if he used: <code>'    test    '</code> the same value is entered in the database do i need to trim that again in javascript ? </p>
  
  <pre><code>function validateForm()
  {
      if(trim(document.insert.aname.value) ==="")
      {
        alert("Animal should have a name");
        document.insert.aname.focus();
        return false;
      }
  }
  function trim(value) {
      return value.replace(/^\s+|\s+$/g,"");
  }
  </code></pre>
  
  <p>please can you help ? 
  the input page is .JSP</p>