A few betas ago, Howard introduced an "omitZero" property to NumberTranslator. Interestingly, omitZero is true by default. This means that, by default, 0's will be formatted as "", even though submitted "0"s are parsed as 0, and submitted ""s are parsed as null. I disagree that special treatment of zero should be the default behavior for NumberTranslator, and more importantly, that omitZero=true creates asymmetric parse/format/parse behavior and am entering a Jira issue for it.
In the meantime, just turn off omitZero. i.e. <binding name="translator" value="translator:number,omitZero=false"/> Paul Wouter De Vaal wrote: >Hi, > >I'm using tapestry 4 beta 6 and I have an issue using numeric >validated/translated numbers. When I enter a zero valid, it gets saved >just fine, but when I bring the page back up, it shows nothing, where >I would like it to show '0' in my textfield. > >Here is my component spec: > > <component id="inputStock" type="TextField"> > <binding name="displayName" value="literal:Op voorraad"></binding> > <binding name="translator" >value="translator:number,pattern=0"/> > <binding name="validators" value="validators:required,min=0"/> > <binding name="value" value="ognl:item.stock"/> > </component> > >I use zero because I read this in the javadoc for DecimalFormat: > >Symbol Location Localized? Meaning >0 Number Yes Digit ># Number Yes Digit, zero shows as absent > >Second question: is there a way to let tapestry check wheter a whole >number is entered, using the new validator framework? So when I enter >1.5 gives an error. > >Regards, >Wouter de Vaal > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > >
smime.p7s
Description: S/MIME Cryptographic Signature
