You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Carlos Martínez <ca...@uib.es> on 2008/02/22 09:09:01 UTC

Cforms, Fomatting a money type

Hello,

I'm developing a form aplication that need to save a money information 
about the user.

My cforms definition looks like this:

<fd:field state="active" required="true" id="monetari">
    <fd:datatype base="decimal">
        <fd:convertor variant="number" type="formatting">
           <fd:patterns>
                <fd:pattern>#,###.##</fd:pattern>
            </fd:patterns>
        </fd:convertor>
    </fd:datatype>
    <fd:label>Money</fd:label>
    <fd:help>Money Money</fd:help>
</fd:field>

and my cfoms binding:

<fb:value path="CAMP[@Id='monetari']/VALORS_CAMP/VALOR" id="monetari">
    <fd:datatype base="decimal">
        <fd:convertor type="formatting">
            <fd:patterns>
                <fd:pattern>#,###.##</fd:pattern>
            </fd:patterns>
        </fd:convertor>
    </fd:datatype>
</fb:value>

It's so simple, that have to work fine. But when i look the XML of the 
binding that inserts to the DB, the value of the field is this:

<VALOR>1234.98000000000001818989403545856475830078125</VALOR>

the original value is 1234,98

How i can solve this?. Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org