This is a migrated thread and some comments may be shown as answers.

How to prevent user from entering non-digits to NumericTextBox on mobile devices?

1 Answer 238 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Maxim
Top achievements
Rank 2
Maxim asked on 10 Sep 2014, 11:31 AM
Hello,

Currently user is able to enter any characters into NumericTextBox from mobile device (Android phone, for example). I've tested it on desktop browsers - an it works like expected. User cannot enter non-digits (IE, Chrome), event Chrome with mobile emulation works ok. But it does not work on mobile browser.

You can see it event on demo site http://demos.telerik.com/kendo-ui/numerictextbox/index, if you open it on the phone or tablet.

Is there any way to prevent user from entering invalid chars into the NumericTextBox?

Thank you

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 12 Sep 2014, 08:05 AM
Hello Maxim,

The NumericTextBox widget validates user input using keydown and keypress events. Unfortunately, keypress is not triggered in mobile devices and most importantly keydown event cannot be prevented. Demo demonstrating this can be found here.

This mobile browser limitation prevents the correct widget behavior and unfortunately I am out of ideas how this issue could be overcome. I would suggest you use a regular <input type="number" /> element in mobile devices.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
NumericTextBox
Asked by
Maxim
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Share this question
or