Use a Text Input object, found under the User Interface section when creating a new object. With this you can define what type of text to expect, and it can limit the input: