trimming text input before sending to api