The NumberTranslator has an omitZero property, which by default is true
(personally, I think the more intuitive default value should be false).
You can override this property in your translator binding like so:

<component id="minuteField" type="TextField">
  <binding name="value" value="ognl:minute" />
  <binding name="translator" value="translator:number,omitZero=false" />
  <binding name="validators" value="validators:min=0,max=59" />
</component>


Paul

Lukas Ruetz wrote:
> hello list
>
> I have an integer value that is read/set in a TextField.
> a number-translator is attached for convertion, what works
> fine.
>
> but the form-field is emtpy if the integer "0" (zero) is
> returned by the getter (when the form is displayed). setting
> a zero (form-submit) is no problem. other values are ok.
>
> why can't the translator return a zero? if I try it without
> translator/validators the zero is shown.
>
> <component id="minuteField" type="TextField">
>   <binding name="value" value="ognl:minute" />
>   <binding name="translator" value="translator:number" />
>   <binding name="validators" value="validators:min=0,max=59" />
> </component>
>
> public int getMinute()
> public void setMinute(int min)
>
> the rendered HTML looks like
> <input type="text" name="minField" value="" id="minField" size="2" 
> maxlength="2"/>
>
> I'm using T4.0
>
> any ideas?
> thanks
> lukas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to