PDA

View Full Version : extjs vtype does not work on textarea



fafche
20 Dec 2010, 4:09 AM
ok , I have a vtype for english and sign only that looks like this:

Ext.apply(Ext.form.VTypes, {
excel: function (v) {
return /^.*.(xls)$/.test(v);
},
excelText: 'Must be an *.xls file',
englishOnly: function (v) {
return /^[a-z0-9,\.\~\!\@\#\$\%\^\&\*\(\)\_\+\<\>]*$/.test(v);
},
englishOnlyTest: 'Must be English letters'
});

now I have a form that looks like this:


new Ext.FormPanel({
id: 'add-label-form',
url: hp,
frame: true,
baseParams: { actionName: 'AddLable' },
defaultType: 'textfield',
labelWidth: 70,
items: [{
id: 'tbKey',
fieldLabel: localize.key,
allowBlank: false,
name: 'tbKey',
anchor: '100%'
}, {
id: 'tbHebrewTran',
fieldLabel: localize.hebrew,
allowBlank: false,
name: 'tbHebrewTran',
anchor: '100%'
}, {
id: 'tbEnglishTran',
fieldLabel: localize.english,
allowBlank: false,
name: 'tbEnglishTran',
anchor: '100%'
}, {
id: 'tbDescription',
xtype: 'textarea',
vtype:'englishOnly',
fieldLabel: localize.description,
allowBlank: true,
name: 'tbDescription',
anchor: '100%'
}],
buttons: [{
text: localize.submit,
formBind: true,
handler: onAddLabelSubmitClick
}, {
text: localize.reset,
handler: function () {
var f = Ext.getCmp('add-label-form').getForm();
f.reset();
}
}]
})

The vtype handler is called and returns false as expected but the form is still valid and no alert is displayed on the screen... why is that?