[Bug 12885] New: Add a new input type=numeric

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12885

           Summary: Add a new input type=numeric
           Product: HTML WG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: adrianba@microsoft.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


HTML5 defines input type=number which allows developers to create an input
element for collecting valid real numbers. Input type=number is insufficient
for telephone numbers because telephone numbers may have special formatting or
allow characters which are not numeric. For this there is a specific telephone
input type.

There are other cases when developers need to optimize for numeric input but
they don't want to require a valid floating point number. A prime example of
this is input elements for US zip codes which can have leading zeros and some
non-numeric characters. Other use cases for numeric input which may not
actually be a real number is a credit card number, passport ID number or
product sku number.

Webkit already attempts to solve this problem by displaying a numeric keyboard
when the developer has set the pattern attribute to "[0-9]*" or "\d*".
(Reference:
http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html#//apple_ref/doc/uid/TP40009542-CH5-SW1)
This is a mainstream scenario and developers should have a declarative way to
indicate that they want a text field optimized for numeric input.

We propose a new input type for this scenario, input type=numeric.  This type
would be exactly the same as the text and search state
(http://dev.w3.org/html5/spec/states-of-the-type-attribute.html#text-state-and-search-state).
The difference between the Numeric state and the Text and Search states is that
on platforms which support soft keyboards optimized for entering different data
types, the Numeric state might result in a soft keyboard optimized for entering
numeric digits. 

The difference between the Numeric state and the number state
(http://dev.w3.org/html5/spec/number-state.html#number-state) is that the
numeric state does not require that the value be a valid floating point number.
 It also does not support any of the methods/attributes which depend on the
value being a valid number such as valueAsNumber, stepUp and stepDown.
Developers can still use the pattern attribute if they want client side
validation.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Friday, 3 June 2011 22:28:39 UTC