1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
// custom Vtype for vtype:'MonType'
Ext.apply(Ext.form.field.VTypes, {
MonType: function(v) {
return /^[A-Za-z]{4}\s\d{6}\-\d{1}$/.test(v);
},
MonTypeText: 'Doit être au format "AAAA 123456-1"'
});
win = Ext.create('widget.window', {
title: 'test',
header: {
titlePosition: 2,
titleAlign: 'center'
},
closable: true,
closeAction: 'hide',
width: 600,
minWidth: 350,
height: 350,
items: [{
xtype: 'textfield',
fieldLabel:'regexp',
itemId: 'test',
allowBlank: false,
enforceMaxLength: true,
maxLength: 20,
vtype:'MonType'
},{
xtype: 'textfield',
itemId: 'test2',
fieldLabel:'pas de validateur'
}]
});
win.show(); |
Partager