Quote Originally Posted by mitchellsimoens View Post
You can set the pattern attribute and even listen to keydown event. Here is an example I had to use for an app:

Code:
Ext.define('Ux.field.PatternText', {
    extend : 'Ext.field.Text',
    xtype  : 'patterntextfield',

    config : {
        pattern : '[0-9]*'
    },

    updatePattern : function(pattern) {
        var component = this.getComponent();

        component.updateFieldAttribute('pattern', pattern);
    },

    initialize : function() {
        this.callParent();

        var component = this.getComponent();

        component.input.on({
            scope   : this,
            keydown : 'onKeyDown'
        });
    },

    onKeyDown : function(e) {
        var code = e.browserEvent.keyCode;

        if (!(code >= 48 && code <= 57) && !(code >= 97 && code <= 105) && code !== 46 && code !== 8) {
            e.stopEvent();
        }
    }
});
You can of course make onKeyDown work for you, mine is a little verbose. It also stops copy paste

Thanks mitchellsimoens , but is there any way to prevent special characters like ( ! & %) ?
pattern : '[0-9]*' and keyCode's that you wrote is not working for special characters in Ext.field.Text Sencha touch.

Thanks