I believe by overriding textFormat you can customize the way number is
being displayed
And the way text is being converted to number inside wicket.

to format field data while user prints you need to use JS llibrary
for ex. this one http://flaviosilveira.com/Jquery-Price-Format/ looks
promising ....

On Tue, Oct 24, 2017 at 8:00 PM, Kamil Paśko <kamil.pa...@solsoft.pl> wrote:

> Maxim,
>
> I tried with:
>
>     private final class MyFormattedField extends TextField<String>
> implements ITextFormatProvider {
>         private MyFormattedField(String id, IModel<String> model) {
>             super(id, model);
>         }
>
>         @Override
>         public String getTextFormat() {
>             return "### ###.###";
>         }
>     }
>
> but this doesn't do anything.
>
> user can type "12321321321" and value is not formatted
>
>
> W dniu 2017-10-24 o 14:37, Maxim Solodovnik pisze:
>
>> I believe you can override "getTextFormat <https://ci.apache.org/project
>> s/wicket/apidocs/8.x/org/apache/wicket/markup/html/form
>> /AbstractTextComponent.ITextFormatProvider.html#getTextFormat-->()"
>> method and provide your own format
>> According to right align: you can use CSS class for that :)
>>
>> On Tue, Oct 24, 2017 at 6:52 PM, Kamil Paśko <kamil.pa...@solsoft.pl
>> <mailto:kamil.pa...@solsoft.pl>> wrote:
>>
>>     Dear Wicket user group,
>>
>>
>>     I have a TextField (but I can use NumberTextField as well) and
>>     when user types a number I want that:
>>
>>     1) number is positioned to the right
>>
>>     2) thousands are separated by spaces
>>
>>     3) floating point character is "."
>>
>>     How can I "force" that format in a TextField?
>>
>>     Kind regards,
>>
>>     Kamil
>>
>>
>>
>>
>> --
>> WBR
>> Maxim aka solomax
>>
>
>


-- 
WBR
Maxim aka solomax

Reply via email to