Jonathan,
If you add some css to the input field then the upper/lower case nightmare can be solved.
See for example:
<input type="text" style="text-transform:lowercase;" />
Removing the trailing space will require some java script, see for example http://jsfiddle.net/jstoolsmith/ZNQQm/