I think for any UI input field, we should do the following check:
1. whether empty string is allowed 2. whether duplicate value is allowed 3. whether special character is allowed, like: @, #, $, & etc.
So base on those requirements, here is something for UI
1. input value should be trimmed 2. use some method like 'escape' to escape those speical characters 3. it’s better to have some 'AJAX' check whether the value (always the name) is already existed