Note that there are some explanatory texts on larger screens.

plurals
  1. POForce a numeric keyboard but allow punctuation: HTML5, mobile Safari
    primarykey
    data
    text
    <p>I'm building an HTML page to be viewed in mobile Safari [and other platforms]. The page lets the user specify several start and end times. They have to input at least two times, and possibly more depending on their situation. </p> <p>I want the user to be able to input their times as numbers and punctuation using the numeric-SHIFT mode keyboard, i.e. the user will see fields like this: </p> <p><img src="https://i.stack.imgur.com/B3C61.png" alt="form fields"></p> <p>And they'll get the numeric-SHIFT keyboard when they focus into the field:</p> <p><img src="https://i.stack.imgur.com/JD3PY.png" alt="enter image description here"></p> <p><strong>Won't work:</strong> </p> <p><code>&lt;input type="time"&gt;</code> (and related datetime types) is not an option. The scrolly-wheel is unacceptable from an HCI perspective, particularly for repeated entries. </p> <p><code>&lt;input type="number"&gt;</code> does the right thing at first. It triggers the keyboard in numeric-SHIFT mode, i.e. the numeric &amp; punctuation portions are visible by default. But when you exit the field, mobile Safari strips out punctuation (i.e. the colon). I tried turning off validation in the form using <code>novalidate</code> but that didn't work.</p> <p><code>&lt;input type="text" pattern="[0-9]*"&gt;</code> triggers the telephone keyboard with no way to enter the colon character.</p> <p>I may just need a different RegExp in the PATTERN attribute, but each one I've tried triggers the normal alpha keyboard, and the user has to hit a key to get to the numeric-SHIFT keypad. </p> <p>Can anyone tell me how to force the keyboard into numeric-SHIFT display without triggering harsh validation rules on the user's input? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload