wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamil Paśko <kamil.pa...@solsoft.pl>
Subject Re: How to format number in (Number)TextField?
Date Tue, 24 Oct 2017 13:00:59 GMT
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/projects/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.pasko@solsoft.pl 
> <mailto:kamil.pasko@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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message