cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: Help [Woody] Decimal Format incorrect from binding
Date Mon, 01 Mar 2004 18:53:26 GMT
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

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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


Mime
View raw message