react-intl-tel-input icon indicating copy to clipboard operation
react-intl-tel-input copied to clipboard

Number Validation

Open nskjakka opened this issue 7 years ago • 6 comments

Hi,

Currently I'm able to type text also in the input box. I want to restrict the typing to numbers only. I can show error messages when text is typed, but it would be great if I can restrict the typing only to number. As I'm using this by installing, I need this restriction from your source only.

nskjakka avatar Aug 03 '18 10:08 nskjakka

@patw0929 we can add an option to restrict only numbers as a custom attribute to <IntlTelInput>.

Any thoughts on this?

superhit0 avatar Aug 03 '18 17:08 superhit0

Does this option exists? I can't find it anywhere and can't validate on methods available. Is it possible to avoid input change on onPhoneNumberChange, checking if "value" is a number? I can't find a way to block non-numbers being typed.

muriloSanto avatar Jun 19 '19 18:06 muriloSanto

@patw0929 @muriloSanto @superhit0 Hi Guys, Did anyone find out a way to have numbers only.

sphingu avatar Oct 17 '19 11:10 sphingu

Not yet, we can validate that is not a valid filling to our form validation, but cannot avoid to have the user to type only numbers.

muriloSanto avatar Oct 17 '19 12:10 muriloSanto

I ended up using a numeric keypad UI that sets the value on the input, and blurring focus events manually on the input.

axebox avatar Mar 24 '20 18:03 axebox

Hello any one who found the solution to this issue? I am trying to do this in https://www.npmjs.com/package/react-intl-tel-input. I want the user to allow only numbers in this field

majidaliharoon-dev avatar Sep 08 '21 07:09 majidaliharoon-dev