Re: [suggestion] Another field type for HTML form inputs

Hi Silvia.

Well, currency is not necessarily a float value...in Brazil, currency uses
"comma" as decimal separator and point as the thousand separator.
Our Operational System(therefore, our browsers) know that, but float
numbers are still the same(point for decimal with no separator for
thousand).

I think the advantages would be:
* we could have the css possibilities, like :negative and :positive styles,
or offer the option for the browser to show/hide the currency symbol as the
user focus it or not.
* When building a webapp, I had to apply these features via javascript
loading extra libraries or building my own!
* Number fields do not accept characters like coma, so, to apply a mask to
it(in brazilian format) I had to use an input of type text :(
* I believe it would be semantically useful and could help increasing
usability and customization, besides avoiding some other libraries to be
loaded unnecessarily!
* Screen readers could read such fields differently...let's say, instead of
reading "two thousand dot eleven" (a float value), it could read "two
thousand dollars and eleven cents" or something like this.

What do you think? Maybe, just some changes could be added to the number
input to fit these features, so there wouldn't be needed another input type?

Cheers.



On Wed, May 15, 2013 at 6:46 AM, Silvia Pfeiffer
<silviapfeiffer1@gmail.com>wrote:

> Hi Felipe,
>
> The example under <input type=number> uses a currency example:
>
> http://www.w3.org/html/wg/drafts/html/master/single-page.html#number-state-(type=number)
>
> Is that not sufficient?
>
> Cheers,
> Silvia.
>
> On Wed, May 15, 2013 at 12:56 AM, Felipe Nascimento de Moura
> <felipenmoura@gmail.com> wrote:
> > 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
> > LinkedIn: http://goo.gl/qGmq
> >
> > Meet some of my projects:
> > BrazilJS Conference  |  BrazilJS Foundation  |  Power Polygon  |
>  TheWebMind
> > |  PHPDevBar
> > ---------------------------------
> > LinuxUser #508332
> > Changing  the  world  is the least I expect from  myself!
>



-- 
*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 Wednesday, 15 May 2013 14:11:24 UTC