Hi,
Use a NumberField instead of DoubleField with this pattern:
f.setPattern("#.00");
Even so, the pattern is simply a visual display property, the underlying value
isn't changed. It
sounds as it you want the actual value to be changed. For that you'll need a
custom field. Have a
look at NumberField.getValueObject and adopt it to your needs.
Kind regards
Bob
On 2/02/2011 01:40, Gilberto wrote:
>
>
> 2011/2/1 Hiren Patel <[email protected]
> <mailto:[email protected]>>
>
> Hi,
>
> I have tried the following code.
>
> DecimalFormat numberFormat = new DecimalFormat("###.##"); // pattern
> according to
> DecimalFormat api.
> doubleField.setNumberFormat(numberFormat);
>
>
> now even thou I put values other that of format 000.00 its validation
> come to true.
>
> There is nothing wrong with that behavior. The validation occurs in terms of
> ranges and in the
> client side, disallowing character input.
>
> Regards,
>
> Gilberto
>
>
> T & R,
>
> Hiren
>
>
>
> On 2/1/2011 6:20 PM, Gilberto wrote:
>> Hi, Hiren!
>>
>> You can use the NumberField[1] control or any of the**subclasses:
>> DoubleField, IntegerField,
>> LongField.
>>
>> Regards,
>>
>> Gilberto
>>
>> [1]http://click.apache.org/docs/extras-api/org/apache/click/extras/control/NumberField.html
>>
>>
>> 2011/2/1 Hiren Patel <[email protected]
>> <mailto:[email protected]>>
>>
>> Hi,
>>
>> I need a format to validate my double field value.
>>
>> My double field format is 5,2 in database.
>>
>> What and how I set the value on the double field to validate against
>> this format.
>>
>> Thanks,
>>
>> Hiren
>>
>>
>