Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ExtJS vtype作为函数_Extjs - Fatal编程技术网

ExtJS vtype作为函数

ExtJS vtype作为函数,extjs,Extjs,是否有任何方法可以在不使用表单的情况下对值测试vType 例如,我实现了一个自定义vtype来进行ajax验证,但是我还想对email vtype运行它,所以我希望在自定义vtype中按照 validate('abc@de.ce','email'); 你可以使用函数而不是属性,然后你可以调用它们: Ext.apply(Ext.form.VTypes, { // Validates an ajax thingy ajax: function(v) { // va

是否有任何方法可以在不使用表单的情况下对值测试vType

例如,我实现了一个自定义vtype来进行ajax验证,但是我还想对email vtype运行它,所以我希望在自定义vtype中按照

validate('abc@de.ce','email');

你可以使用函数而不是属性,然后你可以调用它们:

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');