I’m working on form validation and I have used Vtypes to check number ranges.
It’s all working fine, except I need to include my own allowed values ( field.minValField and field.maxValField) in the ‘numberrangeText’. Is there any way to do that ?
Thanks in advance
Ext.apply(Ext.form.VTypes, {
numberrange : function(val, field) {
if(val < field.minValField || val > field.maxValField){
console.log(field);
return false;
}
},
numberrangeText: 'Value Range Should Be: '
});
Arfeen
There is no way to use templates or XTemplates in numberrangeText. Because they(extjs) just take this string without changes as I’ve found out from file
src/widgets/form/TextField.jsfrom the lineerrors.push(this.vtypeText || vt[this.vtype +'Text']);.But as you can see you can use
field.vtypeTextinstead.For example you can write something like this:
in your
numberrangefunction.You can see what I’m talking about in this example