ExtJS vtype as a function

Is there a way to check vType for a value without being in shape?

For example, I have my own vtype implemented to check ajax, however I would also like to run it against email vtype, so I was hoping to run something inside my custom vtype line by line

validate(' abc@de.ce ','email'); 
+4
source share
1 answer

You can use functions instead of properties, then you can just call them:

 Ext.apply(Ext.form.VTypes, { // Validates an ajax thingy ajax: function(v) { // validate against email VType return Ext.form.VTypes.email(v); }, // Override the default Ext function, to allow oddly-placed hyphens email: function(v) { var regex = /^[-\w][-+\.\w]*@[-\w\.]+\.[A-Za-z]{2,4}$/; return regex.test(v); } } Ext.form.VTypes.ajax(' abc@de.ce '); 
+5
source

All Articles