Is there a way to specify the type of input a user can enter...

for example, I would like to have the user only allowed to enter a number from 0-9, and it wouldn't allow him to enter letters or symbols.