Jump to content

Correct db field settings for currency?


Apfelstrudel

Recommended Posts

Hello,

I have a custom field in one of my databases which contain a price. Now I want to allow the people to enter a price with or without thousand seperators and with or without cent seperator.

So far so good. I added a text field with following regex: /^\d+(,|.)?\d{0,2}$/

I can enter a a price like 3,000.11. That's good but in display view I do not see any thousand seperators.

How can I do this? I also tried the format setting "format numerically" but then the cent digits are being cut off.

And I tried to modify the custom output code of the field to:

{{if $formValue}}
{number_format(floatval($value))}
{{endif}}

... but ... nope. Didn't work!

What am I doing wrong?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...