- From: <bugzilla@jessica.w3.org>
- Date: Mon, 19 Dec 2016 19:33:11 +0000
- To: public-html-bugzilla@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=30035
Bug ID: 30035
Summary: Input type currency
Product: HTML.next
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P2
Component: default
Assignee: dave.null@w3.org
Reporter: jeffrey.l.worthington@gmail.com
QA Contact: public-html-bugzilla@w3.org
CC: mike@w3.org, robin@w3.org
Target Milestone: ---
Input type of number is good for small numbers, but for currency amounts over
999 the unformatted number being input is hard to read. Imagine having to type
in 45,000,000 without the visual feedback of the commas.
We can accomplish this with JavaScript (on an "input" event listener, e.g.):
function localizeCurrency() {
var oldValue = this.value;
this.rawValue = oldValue ?
parseInt(oldValue.replace(/,/g, '')) : 0;
if (oldValue) {
var newValue = parseInt(oldValue.replace(/,/g,
'')).toLocaleString();
var caretPos = this.selectionStart -
(oldValue.length - newValue.length);
this.value = newValue;
this.setSelectionRange(caretPos,caretPos);
}
}
But it requires an input type of "text" (to allow the commas to appear), and it
would be much better to have this in the HTML itself.
<input type="currency" locale="usd">
As I type...what should appear
1 $1.00
10 $10.00
1000 $1,000.00
450000 $450,000.00
--
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Monday, 19 December 2016 19:33:19 UTC