If you want to take a chance with drafts, you can use the type of number :
<input name="foo" type="number">
(See also specification )
Browser support for this is currently very limited, but increasing. You probably want to add JavaScript to simulate support in less bleeding browsers. There are various projects for this, including jsh5f and webforms2 .
Obviously, no matter what approach you take to this problem, you still need to check the data on the server side (you can never trust the client, since any restrictions that you impose can be circumvented by the user).
source share