Hello,
I found out something strange (in my eyes) about the validators.
I have a simple form, where I validate the email adres. When I create the form there's no problem (for adding records to my database). But when I want the edit a record, I create the form and call the onLoad-function to load the data. From that moment it calls the email-validator, and it just keeps validating the email adres. You don't see it, but I tested it by adding console.log(v); in the source. And it won't stop. Why is this? Does this has a reason?
Why am I asking? For the email validator it's not a problem. But I'm creating my own validators, with ajax request to the server (e.g. to validate double-entries), it just keeps firing those ajax request that make a lot of trafic offcourse.
remark: this is only happening with monitorValid = true
ext-all-debug
PHP Code:
Ext.form.VTypes = function () {
..
return {
'email': function (v) {
console.log(v);
return email.test(v);
},
}...
mycode:
PHP Code:
form = new MyApp.TestObject.form();
form.onLoad();
MyApp.TestObject.form = Ext.extend(Ext.FormPanel, {
initComponent: function () {
Ext.apply(this, {
url: '',
defaultType: 'textfield',
monitorValid: true,
items: [{
name: 'email',
xtype: 'textfield',
allowBlank: true,
fieldLabel: 'email',
vtype: 'email'
}],
buttons: [{
text: 'Opslaan',
formBind: true,
scope: this,
handler: this.formSubmit
}]
}) // eo apply
Ext.apply(this, Ext.apply(this.initialConfig, this.config));
MyApp.TestObject.form.superclass.initComponent.apply(this, arguments);
} // eo init
,
onLoad: function () {
this.load({
url: '/' + module + '/' + controller + '/get',
waitMsg: 'Loading...',
params: {
id: this.notaris_id
},
success: function () {}
});
}