I get a “Missing or incorrect value” error when I define the “Calculated Value” of a Dollars-and-Cents control to be the sum of two numbers whose sum is greater than $999,999.99 and test the form.
I created a simple example that exhibits the problem (XML below). There are two Dollars and Cents controls “amount_1” and “amount_2” (which Form Builder built as Decimal data type controls) and another Dollar-and-Cents control (“total_amount”) that has a calculated value of the sum of the first two. The XML below has another control which I describe two paragraphs below.
It seems that I should be able to enter “999999.99” in amount_1 control and “.01” in amount_2 control and have total_amount display “$ 1,000,000.00”. Instead, total_amount displays “$ 1.0E”.
I found references to “oxf.xforms.format.output.decimal” which has a default format that looks acceptable (
I am writing a banking application, so I want to use data types that are not prone to imprecision or rounding problems (floating point) and I need to show the cents part of the value as two decimal places. The bank agent needs to be able to work with numbers that total more than $ 1,000,000.00.
Would someone please point out what I am doing incorrectly or point me in the direction of the right documentation?
I am working with Orbeon Forms 3.9.1.201202031753 PE on a Windows 7 PC.
Thank you.
XML:
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:exforms="http://www.exforms.org/exf/1-0" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:saxon="http://saxon.sf.net/" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <xhtml:head> <xhtml:title>Format Test Form</xhtml:title> <xforms:model id="fr-form-model">
<!-- Main instance --> <xforms:instance id="fr-form-instance"> <form> <section-1> <amount_1/> <amount_2/> <total_amount/> <total_amount_output/>
</section-1> </form> </xforms:instance>
<!-- Bindings --> <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')"> <xforms:bind id="section-1-bind" nodeset="section-1"> <xforms:bind id="amount_1-bind" nodeset="amount_1" type="xforms:decimal" name="amount_1"/> <xforms:bind id="amount_2-bind" nodeset="amount_2" type="xforms:decimal" name="amount_2"/> <xforms:bind id="total_amount-bind" nodeset="total_amount" name="total_amount" type="xforms:decimal" calculate="if ($amount_1 castable as xs:double and $amount_2 castable as xs:double) then $amount_1 + $amount_2 else 123456789012345"/> <xforms:bind id="total_amount_output-bind" nodeset="total_amount_output" type="xforms:decimal" calculate="if ($amount_1 castable as xs:double and $amount_2 castable as xs:double) then $amount_1 + $amount_2 else 0987654321" name="total_amount_output"/>
</xforms:bind> </xforms:bind>
<!-- Metadata --> <xforms:instance id="fr-form-metadata" xxforms:readonly="true"> <metadata> <application-name>BusTravelApp</application-name> <form-name>FormatTestForm</form-name> <title xml:lang="en">Format Test Form</title> <description xml:lang="en"/> <author/> <logo mediatype="" filename="" size=""/> </metadata> </xforms:instance>
<!-- Attachments --> <xforms:instance id="fr-form-attachments"> <attachments> <css mediatype="text/css" filename="" size=""/> <pdf mediatype="application/pdf" filename="" size=""/> </attachments> </xforms:instance>
<!-- All form resources --> <!-- Don't make readonly by default in case a service modifies the resources --> <xforms:instance id="fr-form-resources" xxforms:readonly="false"> <resources> <resource xml:lang="en"> <amount_1> <label>Amount 1</label> <hint/> <help/> <alert/> </amount_1> <amount_2> <label>Amount 2</label> <hint/> <help/> <alert/> </amount_2> <total_amount> <label>Total Amount</label> <hint/> <help/> <alert/> </total_amount> <total_amount_output> <label>Total Amount Output</label> <hint/> <help/> <alert/> </total_amount_output> <section-1> <label>Section-1</label> <help/> </section-1>
</resource> </resources> </xforms:instance>
<!-- Utility instances for services --> <xforms:instance id="fr-service-request-instance" xxforms:exclude-result-prefixes="#all"> <request/> </xforms:instance>
<xforms:instance id="fr-service-response-instance" xxforms:exclude-result-prefixes="#all"> <response/> </xforms:instance>
</xforms:model> </xhtml:head> <xhtml:body> <fr:view> <xforms:label ref="instance('fr-form-metadata')/title"/> <fr:body> <fr:section id="section-1-section" bind="section-1-bind"> <xforms:label ref="$form-resources/section-1/label"/> <xforms:help ref="$form-resources/section-1/help"/> <fr:grid columns="4"> <xhtml:tr> <xhtml:td> <fr:currency xmlns="http://orbeon.org/oxf/xml/form-builder" xmlns:exf="http://www.exforms.org/exf/1-0" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" bind="amount_1-bind" id="amount_1-control"> <xforms:label ref="$form-resources/amount_1/label"/> <xforms:hint ref="$form-resources/amount_1/hint"/> <xforms:help ref="$form-resources/amount_1/help"/> <xforms:alert ref="$fr-resources/detail/labels/alert"/> </fr:currency>
</xhtml:td> <xhtml:td> <fr:currency xmlns="http://orbeon.org/oxf/xml/form-builder" xmlns:exf="http://www.exforms.org/exf/1-0" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" bind="amount_2-bind" id="amount_2-control"> <xforms:label ref="$form-resources/amount_2/label"/> <xforms:hint ref="$form-resources/amount_2/hint"/> <xforms:help ref="$form-resources/amount_2/help"/> <xforms:alert ref="$fr-resources/detail/labels/alert"/> </fr:currency> </xhtml:td> <xhtml:td> <fr:currency xmlns="http://orbeon.org/oxf/xml/form-builder" xmlns:exf="http://www.exforms.org/exf/1-0" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" id="total_amount-control" bind="total_amount-bind"> <xforms:label ref="$form-resources/total_amount/label"/> <xforms:hint ref="$form-resources/total_amount/hint"/> <xforms:help ref="$form-resources/total_amount/help"/> <xforms:alert ref="$fr-resources/detail/labels/alert"/> </fr:currency> </xhtml:td> <xhtml:td> <xforms:output xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary" bind="total_amount_output-bind" id="total_amount_output-control"> <xforms:label ref="$form-resources/total_amount_output/label"/> <xforms:help ref="$form-resources/total_amount_output/help"/> <!-- No hint? --> <xforms:alert ref="$fr-resources/detail/labels/alert"/> </xforms:output> </xhtml:td> </xhtml:tr> </fr:grid> </fr:section> </fr:body> </fr:view> </xhtml:body> </xhtml:html> -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |