Comments? Feedback?

This wiki does not yet support public comments (a limitation of Google Sites), so we encourage you to post your comments either:

On Twitter by responding to @orbeon.

On our community mailing list: subscribe sending an email to ops-users-subscribe@ow2.org (content of subject/body doesn't matter), you'll get a response with the email to use to send your message to the community mailing list.

Recent site activity

Currency


Rationale

The currency component is an input field specialized to capture amounts in a particular currency. When the input field doesn't have the focus, it shows a formatted currency, such as $ 1,234.00. When the control has the focus, it shows the plain number, such as 1234.

While working with currency amounts, the component is careful not to do any manipulation that relies on how numbers are represented on a particular platform, to avoid any possibility of rounding or precision error. [SINCE: 2011-03-07]

Currency prefix

By default the dollar sign ($) is used as a currency prefix. You can override this either:
  • Globally for all your forms in your properties-local.xml by setting the following property:

    <property as="xs:string" name="oxf.xforms.xbl.fr.currency.prefix" value="£"/>

  • For a particular instance of the component:
    • With the prefix attribute, for static values.
    • With the <fr:prefix> element, for dynamic values.

Digits after the decimal sign

By default, the component shows the value to 2 digits after the decimal sign. You can override this either:
  • Globally for all your forms in your properties-local.xml by setting the following property:

    <property as="xs:string" name="oxf.xforms.xbl.fr.currency.digits-after-decimal" value="3"/>

  • For a particular instance of the component:
    • With the digits-after-decimal attribute, for static values.
    • With the <fr:digits-after-decimal> element, for dynamic values.
If you set digits-after-decimal to 0, then the decimal separator isn't shown. The component truncates any additional digits beyond the specified number; it doesn't perform rounding.

Examples

Case
CodeScreenshot
Control without focus
<fr:currency ref="value"/>
Control with focus
(Same as above)
Setting a static prefix with the prefix attribute
<fr:currency ref="value" prefix="£"/>
Setting a dynamic prefix with the <fr:prefix> element
<fr:currency ref="value">
    <fr:prefix ref="/config/prefix"/>
</fr:currency>
Showing 3 digits after decimal sign
<fr:currency ref="value"
    digits-after-decimal="3/>

Showing 0 digits after the decimal sign
<fr:currency ref="value"
    digits-after-decimal="0/>
Read-only input field, because bound to node set as read-only with a MIP.
<xforms:bind nodeset="readonly-node"
    readonly="true()"/>
<fr:currency ref="readonly-node"/>