1

Is it possible to set a mask on a textfield in ST2 ?

{
    xtype: 'textfield',
    name: 'phonenumber',
    label: 'Your phone number',
    mask: '(999) 999-9999'
},

Works in Ext but not in ST, I 'thought' ST was built on top of Ext

Saurabh Gokhale
  • 53,625
  • 36
  • 139
  • 164
Disco
  • 4,226
  • 11
  • 58
  • 76

1 Answers1

3

There's no direct property in Sencha Touch that will do this job.

So, you may need to do something like this ..

{
    xtype: 'textfield',
    name: 'phonenumber',
    label: 'Your phone number',
    placeHolder: '(999) 999-9999',
    listeners : {
      keyup : function( ) {
        // Code that checks the i/p value according to placeHolder goes here ...
      } 
    }
},

Btw, there's one post on Sencha Touch forum.

Hope that helps you!

Saurabh Gokhale
  • 53,625
  • 36
  • 139
  • 164
  • That should do it ! Thank you very much ! – Disco Apr 26 '12 at 13:50
  • I feel that you're on fire today; check my other question out : http://stackoverflow.com/questions/10334893/what-is-the-proper-way-to-load-an-external-javascript-in-sencha-touch-2 – Disco Apr 26 '12 at 14:00