trim whitespace for group name and autocomplete

For post 3.1 release