I found an interesting link
https://flaviocopes.com/how-to-format-number-as-currency-javascript/

Using the ECMAScript Internationalization API, we can let the browser do
the formatting. Now all i need is find/build a mixin that update the value
when user typing the input. And to get the real value when submitting to
the server.

On Fri, Jul 27, 2018 at 10:32 AM abangkis <abang...@gmail.com> wrote:

> Hi geoff, thanks for the link. I was actually looking at the money
> translator when I  first researching. But i stumbled on the requirement
> that it will format the entry when user typing the value. I looked it up,
> some suggest it can be done using javascript. So I started looking at
> mixins.
>
> The currency is only an extra label for now, appended at the front of
> formatted input. So it's possible to just use parameters and didn't save it
> to the database. But the Joda money is interesting, it will help if we want
> to support multiple currencies stored in the db. Thanks.
>
> On Fri, Jul 27, 2018 at 8:14 AM JumpStart <
> geoff.callender.jumpst...@gmail.com> wrote:
>
>> You’ll find some techniques in here:
>>
>>
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/input/augmentingtranslators
>> <
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/input/augmentingtranslators
>> >
>>
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/input/contributingtranslators
>> <
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/input/contributingtranslators
>> >
>>
>> If you are handling multiple currencies, consider using the datatype
>> org.joda.money.Money throughout, except in the entity convert it to
>> BigDecimal and a String currencyCode, and the database use decimal and
>> varchar, respectively.
>>
>> HTH,
>>
>> Geoff
>>
>> > On 26 Jul 2018, at 11:38 pm, abangkis <abang...@gmail.com> wrote:
>> >
>> > Hi, i want to create a money/currency field but get confused on what the
>> > right approach.
>> >
>> > I've been looking at custom validator, translator, mixin, even extending
>> > tapestry TextField it self.
>> >
>> > Basically the requirements is:
>> > - When the user type 100000, it will be shown as a certain format (ex:
>> > 100.000)
>> > - There's a possibility/optional parameter that you can show the
>> currency
>> > symbol ($100.000)
>> >
>> > Can anyone give a little bit direction? Thanks
>> >
>> > --
>> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
>> > twitter : @mreunionlabs @abangkis
>> > page : https://plus.google.com/104168782385184990771
>>
>>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>


-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Reply via email to