field-kit icon indicating copy to clipboard operation
field-kit copied to clipboard

Demo: Number Formatter example not clear

Open kevindeleon opened this issue 9 years ago • 4 comments

Just a heads up, I think the number formatter example is broken on the demo page. Or maybe I just don't understand what it's trying to demo?

http://square.github.io/field-kit/

kevindeleon avatar Sep 28 '15 15:09 kevindeleon

So, I see what's going on now...basically it's just formatting a random number that you receive onload...it's just a bit confusing considering that all the other demos check for, and format, based on what's put in by the user (onchange).

kevindeleon avatar Sep 28 '15 15:09 kevindeleon

Good point, I think there has been others confused with this as well. I'll come up with another number formatter demo.

Thanks

iamJoeTaylor avatar Sep 28 '15 16:09 iamJoeTaylor

We should probably just split it into three: one for currency, one for percentage, and one for normal numbers.

eventualbuddha avatar Sep 28 '15 17:09 eventualbuddha

I am still confused on how NumberFormatter works. What is the code actually doing to the input field? For example, the following code still allows letters and other non currency symbols to be entered. As far as I can tell, it functions just like a plain old text input.

new FieldKit.TextField(element, new FieldKit.NumberFormatter().setNumberStyle(FieldKit.NumberFormatter.Style.CURRENCY))

tropperstyle avatar Dec 24 '15 18:12 tropperstyle