Numeric Text Box on Mobile

3 posts, 0 answers
  1. Ryan
    Ryan avatar
    8 posts
    Member since:
    Jun 2012

    Posted 12 Jan 2014 Link to this post

    I am trying to get the numeric text box to be of type 'number' so that it displays the numeric keypad on mobile, but uses the arrows on desktop.
    But from looking at the code, it appears that the input type should be 'number', so I am confused.
    I am probably missing something as I am relativley new to kendo.

    Thanks in advance.
  2. Georgi Krustev
    Georgi Krustev avatar
    3688 posts

    Posted 13 Jan 2014 Link to this post

    Hello Ryan,

    The NumericTextBox widget is designed to change the type of the input element to text. This is required, because the widget supports internationalized standard and custom numeric formats, which are not allowed in type="number" element. One possible solution is to use a pattern attribute, which will tell the iOS to open keyboard in numeric mode. Please note that this approach does not work in Android devices.

    Georgi Krustev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET AJAX banner
  4. Ryan
    Ryan avatar
    8 posts
    Member since:
    Jun 2012

    Posted 23 Jan 2014 Link to this post

    Hi Georgi,
    Thanks for the reply. This is a bit of an issue for us and have a solution by changing the type the type back on page load.
    For integers this seems to work well, which is all we need it for.

    document.getElementById('WidthInput').setAttribute('type', 'number');

    This cant be done through jQuery as it ignores setting the type as it does not work in IE, but that is not an issue for us.
Back to Top