PDA

View Full Version : To find out whether the custom vtype is loaded in Ext.form.field.VTypes



Higgs.Boson
8 May 2013, 4:32 AM
In my code I register my own vtype:


Ext.apply(Ext.form.field.VTypes, bookNameVType);

In other chunk of code I have to check whether my own vtype is loaded. How can I do it?

slemmon
10 May 2013, 9:36 AM
You should be able to look for you vtype right on Ext.form.field.VTypes.



var timeTest = /^([1-9]|1[0-9]):([0-5][0-9])(\s[a|p]m)$/i;
Ext.apply(Ext.form.field.VTypes, {
// vtype validation function
time: function(val, field) {
return timeTest.test(val);
},
// vtype Text property: The error text to display when the validation function returns false
timeText: 'Not a valid time. Must be in the format "12:34 PM".',
// vtype Mask property: The keystroke filter mask
timeMask: /[\d\s:amp]/i
});


console.log('%cChecking for \'time\'', 'color: red;');
console.log(Ext.form.field.VTypes.time);
console.log('%cChecking for \'newVtype\'', 'color: red;');
console.log(Ext.form.field.VTypes.newVtype);