How to force numeric keypad from an input box (HTML)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    How to force numeric keypad from an input box (HTML)

    I built a web-based application (HTML) optimized for mobile devices. Is there any way to force the numeric pad to come up when clicking an input box (as opposed to the qwerty default)?
  • markmcgookin
    Recognized Expert Contributor
    • Dec 2006
    • 648

    #2
    This is difficult because a "numeric keypad" is a device specific thing.... There may be a way to mask the box so that it can only accept numbers, mobile OSs might be able to pick this up and only show a numeric keypad, but you'll need to refer to each OSs specific documentation to find out if this is possible and what the triggers for such a response would be.

    Comment

    • yarbrough40
      Contributor
      • Jun 2009
      • 320

      #3
      Thanks, yeah I figured this was the case.

      Comment

      • jawadahmad
        New Member
        • Dec 2011
        • 1

        #4
        there is a solution for your problem.
        Use this in your css and your mobile input will be forced to give only number keypad means only numbers will be entered.
        <input type="text" style="-wap-input-format: 'N'"/>

        Comment

        • yarbrough40
          Contributor
          • Jun 2009
          • 320

          #5
          Nice! Thanks..... I'll give it a try

          Comment

          • Simon27
            New Member
            • May 2007
            • 8

            #6
            Or the new HTML5 input types:

            Code:
            <input type="tel">
            <input type="number">
            Will bring up the appropriate keypad if the mobile browser supports it. If not, then it is treated like a text field for backwards compatibility.

            More: http://www.456bereastreet.com/archiv...5_input_types/

            Comment

            Working...