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?
Comma as decimal point
Re: Comma as decimal point
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:
If there is another way, w/o using hooks, I am still interested though.
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']);