im trying validate a textfield with a custom vtype to filter white spaces, ex: " ". I defined my custom vtype in the app.js (im using mvc pattern).
Ext.Loader.setConfig({
enabled : true,
paths: {
Ext: 'vendor/ext41/src',
My: 'app'
}
});
Ext.apply(Ext.form.field.VTypes, {
descartarBlanco: function(value) {
return /^\s+$/.test(value);
}
});
Ext.application({
name: 'CRUDManantiales',
appFolder: 'app',
controllers: ['Ui','Usuarios'],
....
});
But, Firebug show this error:
TypeError: vtypes[vtype] is not a function
I would think that the syntax is correct. But, i dont know where insert the code of Vtype. any idea ?. Thanks.
I put my custom vtypes in my app's controller on before render form.
Ext.define('MyApp.controller.Main', {
extend: 'Ext.app.Controller',
...
init: function () {
var me = this;
me.control({
...
'form': {
beforerender: this.applyVtypes
},
...
})
},
...
applyVtypes: function() {
Ext.apply(Ext.form.field.VTypes, {
descartarBlanco: function(value) {
return /^\s+$/.test(value);
}
}
}
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With