PDA

View Full Version : [3.0] vtype triggers error



cog
10 Feb 2010, 2:58 AM
I am using the Ext desktop.
In a form I want to check on integer value so I have added a vtype through the extend method. Tried different approaches, and included the js-file in different positions in my index-file.

After entering the first character I get the following error:



Error: vt[this.vtype] is not a function
Source file: http://localhost/lib/extjs/ext-all-debug.js Line: 35896
Checked the API, docs, and forum. However, could not find the answer on my problem.

The code I tried for the vtype definition:


Ext.apply(Ext.form.VTypes, {
numTest: /^[0-9]*$/
, num: function(v) {
return numTest.test(v);
}
, numMask: /[0-9]/i
, numText: 'Dit moet een geheel getal zijn, zonder punten of comma.'
});
and:


Ext.apply(Ext.form.VTypes, {
num: function(v) {
return /^[0-9]*$/.test(v);
}
, numMask: /[0-9]/i
, numText: 'Dit moet een geheel getal zijn, zonder punten of comma.'
});
and:


var numTest = /^[0-9]*$/;
Ext.apply(Ext.form.VTypes, {
num: function(v) {
return numTest.test(v);
}
, numMask: /[0-9]/i
, numText: 'Dit moet een geheel getal zijn, zonder punten of comma.'
});
Did try '\d' for '[0-9]' to, but that made no difference. Am I missing a typo or something. Anyone any idea?

If I can't get this to work I probably need to fall back on server side vallidation, after submitting the form.

I found that FF2.0 does not do anything, FF3.0 and IE trigger the error
In MS-scriptdebugger in ext-all-debug,js in


if(this.vtype){
var vt = Ext.form.VTypes;
if(!vt[this.vtype](value, this)){
this.markInvalid(this.vtypeText || vt[this.vtype +'Text']);
return false;
}
}

in: if(this.vtype) -> it is "num"
vt[this.vtype] = undefined
value = "the characters I typed"