Prevent non-numeric input
viveleroi opened this issue · comments
Is there a way to prevent non-numeric input entirely, rather than stripping it out?
For example I can type "foo" into the input, and it's displayed as a value, but then stripped when I blur the field. I need to prevent those characters from being typed in at all. I tried pattern/inputMode just in case but neither do what I need.
Is this possible?
Is it possible to do this in controlled mode?
Are you asking me? I'm not sure what you mean. I guess I need to intercept the onChange or something and prevent anything but numbers/decimals?
Just in case, the onChange
isn't called until a parseable number is present in the field. So if I typed "hhh" the onChange isn't fired until I type an actual number. So I have no power to remove characters as the user types. This feature would need to be handled in the library and should be opt-in.
In BlueprintJS the prop is called allowNumericCharactersOnly