W3C home > Mailing lists > Public > public-html@w3.org > May 2013

[suggestion] Another field type for HTML form inputs

From: Felipe Nascimento de Moura <felipenmoura@gmail.com>
Date: Tue, 14 May 2013 11:56:54 -0300
Message-ID: <CAJVBkVmEfZqi9RY86EFbpZujqTxPXyxp5zQJwYhT-qcXtRSWyQ@mail.gmail.com>
To: public-html@w3.org
Hi.

This is something I see a lot of people doing by themselves across the
internet, or using libraries to do so. To format currency/money inputs.

Therefore, I believe it would be useful if HTML could provide an *input *with
*type* *currency*.

Once the Operational System knows the user's preferences related to
currency, money symbols and format, the browser should be able to render it
with a better solution.
Mobile devices could change their keyboards to only numbers, comas and
points..maybe the symbol($) as well.
These inputs, could have a mask applied, according to the currency (let's
say, in Brazil, the currency format is 1.234,56 while in most countries it
is 1,234.56).

CSS could be able to change its "mask" as it changes list-styles, for
example.

input[type=currency]{
    thousand-separator: coma;
    decimal-separator: point;
    symbol-visibility: focus; /* shows the symbol only when the input is in
focus */
    symbol: none;
    negative: visible; /* allows the negative symbol */
}

I wounder symbol might be a keyword like "real", for brazilian currency
(R$), dollar, us-dollar, aus-dollar, euro, etc...or it could be the string
with the symbol, itself!

Plus, there could be a few states for the element, such as:
input[type=currency]:negative{
    color: red;
}
input[type=currency]:positive{
    color: green;
}

Also, those configurations could be defined in the HTML element
itself...something like:
<input type="currency" thousand="." decimal="," />

Masks with JavaScript are expensive, there are thousands of them, each
working in different ways.
When building web-apps, it would make a lot of difference!

So, I want to hear from you what is your opinion about it.

Thanks for your time.

-- 
*Felipe N. Moura*
Senior Web Developer

Website:  http://felipenmoura.org
 Twitter:    @felipenmoura <http://twitter.com/felipenmoura>
LinkedIn: http://goo.gl/qGmq

Meet some of my projects:
BrazilJS Conference <http://braziljs.com.br/>  |  BrazilJS
Foundation<http://braziljs.org>
|  Power Polygon <http://github.com/braziljs/power-polygon>  |
TheWebMind<http://thewebmind.org/>  |
PHPDevBar<https://addons.mozilla.org/pt-BR/firefox/addon/php-developer-toolbar/>
---------------------------------
LinuxUser #508332
*Changing  the  world*  is the least I expect from  myself!
Received on Tuesday, 14 May 2013 14:58:05 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:46:02 UTC