Masking Date field in gwt

1.5k Views Asked by At

Is there is any way in GWT where date field can be masked with various date formats? http://digitalbush.com/projects/masked-input-plugin (in demo tab)

I came across solutions where in formatting can be applied on loosing the focus with Regex, which is not preferred.

TextfieldMask Plugin in gxt doesn't support date fields. I tried to tweak that little but running into lots of issues.

I explored options of gquery-(JQuery implementation for GWT), that doesnt support mask as of now.

Any suggestions/ideas?

1

There are 1 best solutions below

0
On

You can use JSNI to write a masking function using the jQuery masked input plugin

    public static native void redirect(String id)/*-{
           jQuery(function($){
              $("#"+id).mask("yourmask");
           });
    }-*/;

Then attach a listener to the render event of the panel/form/etc and call the JSNI method.

See if that works