You can change the content type of the input to number - this will allow you to definte minimum and maximum values that the input will accept, anything outside of that will be invalid.