cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JD Daniels ...@datatrio.com>
Subject Re: Help [Woody] Decimal Format incorrect from binding
Date Mon, 01 Mar 2004 19:03:23 GMT
Bruno Dumon wrote:

>On Sun, 2004-02-29 at 06:45, JD Daniels wrote:
>  
>
>>This is probably and easy fix.. I am very tired....
>>
>>I have in a mysql table:
>>
>>assetRetail DECIMAL (9,2)
>>
>>My woody Definition:
>>        <wd:field id="assetRetail">
>>            <wd:label>Assest Retail $</wd:label>
>>            <wd:datatype base="decimal"/>
>>            <wd:convertor variant="number">
>>                <wd:patterns>
>>                    <wd:pattern>#########.##</wd:pattern>
>>                </wd:patterns>
>>            </wd:convertor>
>>        </wd:field>
>>
>>My Woody Binding:
>>    <wb:value id="assetRetail" path="InventoryItem/assetRetail">
>>        <wd:convertor datatype="decimal" type="formatting">
>>            <wd:patterns>
>>                <wd:pattern>#########.##</wd:pattern>
>>            </wd:patterns>
>>        </wd:convertor>
>>    </wb:value>
>>
>>The Problem is, when i load a form, the values are formatted incorrectly...
>>value one 800.00
>>value two 5984.00
>>
>>Loads into the input with 800 and 5,984 not 800.00 and 5984.99 as i 
>>would expect
>>which means if the user just hits save, 5.00 gets entered into the database.
>>    
>>
>
>where does the 5.00 come from?
>
>Anyhow, if you want a digit to show up, you should use 0, such as:
>
><wd:pattern>#########.00</wd:pattern>
>
>See also here for more information on the patterns:
>http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
>
>  
>
The Datatype in the database is DECIMAL(9,2).. and it truncates it at 
the ',' so mysql makes 5,984 into five, and the type is 2 decimal 
places, so it then adds .00

What I am wondering.. Is where does woody get the bright idea to format 
the ',' in for the form input value?

(I have tried 0's instead of #'s.. no difference)

JD


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


Mime
View raw message