Adds delegate method for text field