Comma as decimal point

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
eagle
Veteran Member
Posts: 39
Joined: 2013-01-09 15:38

Comma as decimal point

Post by eagle » 2014-11-13 16:27

I have a field of the decimal type with precition 2.

In Norway we use comma as decimal point, so my users enter "4,25" as a value.

This is then stored as 4.00 in the database.....

How can I make my application accept comma as decimal points?

eagle
Veteran Member
Posts: 39
Joined: 2013-01-09 15:38

Re: Comma as decimal point

Post by eagle » 2014-11-14 13:24

I finally figured this one out :)

Adding the following to the before_insert and before_update hooks will make it possible for the user to enter either 3.14 or 3,14 and it will work:

Code: Select all

$data['Price'] = str_replace(",",".",$data['Price']);
If there is another way, w/o using hooks, I am still interested though.

Post Reply