1. #1
    Sencha User
    Join Date
    Jul 2008
    Posts
    30
    Vote Rating
    0
    vanderbill is on a distinguished road

      0  

    Default How i make a mask for a TextField

    How i make a mask for a TextField


    like a JformattedTextField. Example phone : (##)####-####

    ty for all

  2. #2
    Ext GWT Premium Member
    Join Date
    Jun 2008
    Posts
    50
    Vote Rating
    0
    Manuel Elaraj is on a distinguished road

      0  

    Exclamation


    I second this. Anyone knows how to do masking?

  3. #3
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    3
    gslender is on a distinguished road

      0  

    Default


    I need this too and I'm working on releaseing a UX that will have this feature... simple to the Swing widget of the same name... hopefully in the next day or two

  4. #4
    Ext User
    Join Date
    Jul 2008
    Posts
    17
    Vote Rating
    0
    tbuckel is on a distinguished road

      0  

    Default


    +1

  5. #5
    Ext User
    Join Date
    Feb 2008
    Posts
    8
    Vote Rating
    0
    cgraf is on a distinguished road

      0  

    Default


    +1

  6. #6
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    3
    gslender is on a distinguished road

      0  

    Default


    Not sure if this is what everyone wanted - turned out to be really simple.

    Code:
    public class FormattedNumberField extends NumberField {
    
    	@Override
    	protected void onBlur(ComponentEvent be) {
    		super.onBlur(be);
    		setRawValue(getFormat().format(getValue().doubleValue()));
    	}
    }
    You would use it like...

    Code:
    	    FormattedNumberField annualsalary = new FormattedNumberField();
    	    annualsalary.setFieldLabel("Annual Salary");
    	    annualsalary.setFormat(NumberFormat.getCurrencyFormat());
    	    panel.add(annualsalary);

  7. #7
    Ext User
    Join Date
    Jul 2008
    Posts
    17
    Vote Rating
    0
    tbuckel is on a distinguished road

      0  

    Default


    Cheers. Did it the same way.
    But I was also actually thinking of something which limits the input and skips fixed characters of the format. E.g. a format like "(XXX)-XXXX XXXX" where the cursor automatically skips chars like ()- and jumps to the next available input position. Nothing really important, would be just a nice UI gimmick though.

    Thomas