Motivation[edit | edit source]
You want the view portion of your form to add formatting information to numbers. For example, you want your US currency to be stored in the model as 12345.6789 but the view to display at $12,345.68. Note that the dollar sign is used as a prefix, commas are added and the decimal is rounded to two digits.
Ideally, we would like to use a simple CSS function to indicate that all currency should be formatted using the standard number picture formats such as "$#,###.##".
Method[edit | edit source]
Sample Code[edit | edit source]
<xf:bind nodeset="instance('invoice')/Total" calculate="round((instance('invoice')/Tax + instance('invoice')/SubTotal) * 100) div 100"/>
References[edit | edit source]
The following discussions on the XForms mailing lists might be helpful.