This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23120 - input[type=number] need to provide a way in which the user can validate the user's entered value (e.g. for validation and feedback) -- the current value sanitization algorithm prevents any interaction [...]
Summary: input[type=number] need to provide a way in which the user can validate the u...
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-01 02:08 UTC by contributor
Modified: 2013-10-21 21:03 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2013-09-01 02:08:11 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html
Multipage: http://www.whatwg.org/C#number-state-(type=number)
Complete: http://www.whatwg.org/c#number-state-(type=number)
Referrer: http://stackoverflow.com/questions/16485014/validate-number-type-inputs-with-jquery?rq=1

Comment:
input[type=number] need to provide a way in which the user can validate the
user's entered value (e.g. for validation and feedback) -- the current value
sanitization algorithm prevents any interaction with it if the entered value
is anything but a valid floating point number. Furthermore, it is impossible
to distinguish between invalid-format values and empty-string values.

Posted from: 99.47.180.118
User agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.22 Safari/537.36
Comment 1 Ian 'Hixie' Hickson 2013-09-03 17:40:42 UTC
Is element.validity.badInput insufficient?

The point of type=number is that the browser is the one that's supposed to validate the user's input.
Comment 2 alphagma 2013-09-03 19:19:56 UTC
Hi Ian, thanks for your reply. My bad, at the moment of reporting the issue I was not aware of validity.badInput.

I believe this request can be closed then.

Still, as a suggestion, I would like to say that a value of empty string is misleading, while the string representation of NaN would be more indicative of the current state of the input.
Comment 3 Ian 'Hixie' Hickson 2013-10-10 00:21:02 UTC
The idea is to never expose an invalid value, because doing so would mean that code would need to be ready to handle it. The current design means that you don't have to worry about bad input unless you want to.
Comment 4 Ian 'Hixie' Hickson 2013-10-21 21:03:18 UTC
closing per comment 2. Feel free to file new bugs on related issues. Thanks!