form currency type

edited September 2016 in News & Announcements
I have a form field in a template in a simple module that's defaulting to a currency type, which is find: It's configured in the template as follows:

'from_price' => array('type' => 'currency', 'currency' => '£'),

it's save to the database as JSON correctly

[{...,"from_price":"12,399.00",...

when the module re-renders the value it appears as:

"From price £12.00"

I've checked the documentation and it indicates the separator can be moved, I've tried 0 and 10, 0 didn't make a difference and 10 hung the page.

How should currency be handled in JSON?

We are using the develop branch version of Fuel

Regards

David

Comments

  • edited 7:43AM
    What were the options you added to your form field and what was the expected output you were looking for?
  • edited 7:43AM
    I tried:
    'type' => 'currency', 'currency' => '£'

    and, thinking that 0 would disable the separator
    'type' => 'currency', 'currency' => '£', 'separator' =>0

    Then separator 10, trying to move the separator out of the range of numbers the field would be used for
    'type' => 'currency', 'currency' => '£', 'separator' =>10
  • edited 7:43AM
    It sounds like you are just wanting a number field that has decimals and a before_html value of "£" correct? If so, try the following:
    'type' => 'number', 'before_html' => '£', 'decimal' => TRUE
Sign In or Register to comment.