Automatically trimming user input onBlur or on Server side on end of input?
Looking for best practices on web.
In a general sense, we have an input on our webpage. This input doesn't allow empty space at the end.
Bad:
Apples
Good:
Apples
So what I'm wondering is, how best to handle this.
Options:
- Add error message.
- Trim it on the client side, ie:
onBlur
. - Trim it on the server side.
Any other options?
We're looking for the general best practices. We could have multiple errors that occur, and the user may not expect the changes, or the corresponding input may dictate the rest of a longer workflow.