Post new topic Reply to topic  [ 1 post ] 

Board index : GWT-Ext Forums : Tips, HowTo's and Tutorials

Author Message
 Post subject: [TIP]Format a textfield
PostPosted: Wed Oct 01, 2008 9:11 am 
Offline

Joined: Tue Sep 02, 2008 1:26 pm
Posts: 67
look this:

http://gwt-ext.com/forum/viewtopic.php?f=7&t=2651&hilit=mask

in ur html file... put in body

<script language="javascript" src=pathof InputTextMask.js here />

Code:
public class Mask {
      
   public static final String PHONE = "(99)9999-9999";
   
   public static InputMaskPlugin applyMask(String mask,
         boolean clearWhenInvalid) {
      return new InputMaskPlugin(mascara, clearWhenInvalid);
   }
   

}



Code:
public class InputMaskPlugin extends ComponentPlugin {

   public InputMaskPlugin(String mask, boolean clearWhenInvalid) {
      jsObj = create(mask, clearWhenInvalid);
   }

   protected native JavaScriptObject create(String mask,
         boolean clearWhenInvalid) /*-{
        return new $wnd.Ext.ux.InputTextMask( mask, clearWhenInvalid );
     }-*/;

   @Override
   public void init(Component component) {

   }

}


an example!!!

Code:
txtPhone= new TextField();
    txtPhone.addPlugin(Mask.applyMask(Mask.PHONE, false));


:D :D ;)

the plugin can be downloaded here

http://code.google.com/p/cherryonext/


Back to top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

Board index : GWT-Ext Forums : Tips, HowTo's and Tutorials


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Style by Midnight Phoenix & N.Design Studio
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.