On Mon, 2004-03-01 at 20:03, JD Daniels wrote:
> 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

I see.

> 
> 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)

Then it seems like the specified pattern isn't used at all and it falls
back to the default formatting...

Ah, I see it now: you misplaced the convertor element in the form
definition, it must be inside the datatype element.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to