hi I have a problem on formatted amounts.
On my input form, users can add and edit a formatted amount. Since this is a multi-language program, users can specify their own format, so there isn’t a fixed pattern.
Examples:
250.000
250,000
250.000,00
250,000.00
Sadly, I have to “un-format” them, before store them into the database or MySQL will understand my number as floats and viceversa.
How can I overcome this? Any ideas?
ok, finally I made it, so I’ll share my solution
First of all, I used Mootools to format the input field while to user is typing.
Then I moved server side.
Format options are saved inside my application, so this is the code
Basically I get rid of everything except the decimal separator, then I replace it with the standard one (
.).It works like a charm.