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

2 posts, 1 answers
  1. Maxim
    Maxim avatar
    16 posts
    Member since:
    Jun 2008

    Posted 10 Sep 2014 Link to this post

    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
  2. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 12 Sep 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top