input of Comma-separated decimals into number or currency controls in Orbeon form runner

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

input of Comma-separated decimals into number or currency controls in Orbeon form runner

Irene Weber
Hi,

I am facing a problem with the number and currency controls in Orbeon
4-0-0-9m PE  (but Orbeon 3.9 CE's dollar-and-cent control seems to show
the same behaviour).   We have a requirement that users can input
comma-separated decimals into forms (i.e., with a comma as a decimal
separator, European number format), and that Orbeon shows numbers in
European format (comma as a decimal separator).
Is it possible to do this with Orbeon form runner?

Orbeon allows to define number-decimal-separator and grouping-separator
in properties-local.xml. This suggests that it should be possible to use
controls with European number formats in Orbeon.

I added properties for to properties-local as shown below, and if I
input a number without any decimal separator, the number is visualized
in the control as expected, (e.g., € 12,00). But when inputting a number
with a comma into the number control, Orbeon validates and then rejects
the number with the standard error message (missing or invalid value).

Likewise:
Input a number, e.g. 12 into the number control.
Orbeon visualizes the number as 12,00 (correct!).
Try to edit the number 12,00, eg, by just clicking into the control.
Orbeon re-validates the input an produces its error message.

I have spent a lot of time investigating this issue, and looking into
the source code of the number control, I think I understand why it
doesn't work. Before trying to fix it (newbie) I want to make sure, if
this is really necessary.
So, it would be very helpful to know if it is possible to have controls
with European number INPUT format in Orbeon form runner out-of-box with
appropriate settings (if yes, please, how?), if this a bug and will be
solved sometime or if it is necessary to define a custom control for
European number format (comma as a decimal-separator).

Thank you very much for your response,
Irene


<property as="xs:string" name="oxf.xforms.xbl.fr.currency.prefix"
value="&#x20AC;"/>
<property as="xs:string"
name="oxf.xforms.xbl.fr.currency.digits-after-decimal" value="2"/>
<property as="xs:string"
name="oxf.xforms.xbl.fr.currency.decimal-separator" value=","/>
<property as="xs:string"
name="oxf.xforms.xbl.fr.currency.grouping-separator" value="."/>

<property as="xs:string" name="oxf.xforms.xbl.fr.number.prefix" value=""/>
<property as="xs:string"
name="oxf.xforms.xbl.fr.number.digits-after-decimal" value="2"/>
<property as="xs:string"
name="oxf.xforms.xbl.fr.number.decimal-separator" value=","/>
<property as="xs:string"
name="oxf.xforms.xbl.fr.number.grouping-separator" value="."/>

<property as="xs:string" name="oxf.xforms.format.output.decimal"
value="if (. castable as xs:decimal) then
format-number(xs:decimal(.),'###.###.###.##0,00') else ."/>
<property as="xs:string" name="oxf.xforms.format.output.integer"
value="if (. castable as xs:integer) then
format-number(xs:integer(.),'###.###.###.##0') else ."/>
<property as="xs:string" name="oxf.xforms.format.output.float" value="if
(. castable as xs:float) then format-number(xs:float(.),'#.##0,00') else
."/>
<property as="xs:string" name="oxf.xforms.format.output.double"
value="if (. castable as xs:double) then
format-number(xs:double(.),'#.##0,00') else ."/>






--
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
Reply | Threaded
Open this post in threaded view
|

Re: input of Comma-separated decimals into number or currency controls in Orbeon form runner

pranay
Is there an answer to this post? I have been trying several options to get the fields with decimals the europian way nevertheless no succes.....
Reply | Threaded
Open this post in threaded view
|

Re: input of Comma-separated decimals into number or currency controls in Orbeon form runner

Erik Bruchez
Administrator
I am trying this with 4.8 and things seem to work.

Which version of Orbeon Forms are you using, and what doesn't work specifically?

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: input of Comma-separated decimals into number or currency controls in Orbeon form runner

pranay
Hai Erik,

I am using orbeon 4.6.1 and in the input fields, with type decimal, in a form I would like to type 12,50 instead of 12.50.

I have added

        <property as="xs:string"  name="oxf.xforms.format.output.*.*.decimal" value="if (. castable as xs:decimal) then format-number(xs:decimal(.),'###.###.###.##0,00') else ."/>
        <property as="xs:string"  name="oxf.xforms.format.output.*.*.integer" value="if (. castable as xs:integer) then format-number(xs:integer(.),'###.###.###.##0') else ."/>
    <property as="xs:string"  name="oxf.xforms.format.output.*.*.float"   value="if (. castable as xs:float) then format-number(xs:float(.),'#.##0,000') else ."/>
    <property as="xs:string"  name="oxf.xforms.format.output.*.*.double"  value="if (. castable as xs:double) then format-number(xs:double(.),'#.##0,000') else ."/>

in the properties-local.xml
I also added

<property as="xs:string" name="oxf.xforms.xbl.fr.number.prefix" value=""/>
        <property as="xs:string" name="oxf.xforms.xbl.fr.number.digits-after-decimal" value="2"/>
        <property as="xs:string" name="oxf.xforms.xbl.fr.number.decimal-separator" value=","/>
        <property as="xs:string" name="oxf.xforms.xbl.fr.number.grouping-separator" value="."/>

I can not get the europian notation to work...
Reply | Threaded
Open this post in threaded view
|

Re: input of Comma-separated decimals into number or currency controls in Orbeon form runner

Erik Bruchez
Administrator
So you are using a plain input field (`xf:input`)? If so, try using `fr:number` instead.

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: input of Comma-separated decimals into number or currency controls in Orbeon form runner

Erik Bruchez
Administrator
Maybe related: we identified and fixed an issue with the use of the fr:number when the decimal separator is not ".":

    https://github.com/orbeon/orbeon-forms/issues/2076

-Erik