PDA

View Full Version : Validator in textfield



maksimka2112
7 Apr 2016, 1:28 AM
Hi!
My textField:

var myTxtf = new Ext.form.TextField ({
validator: function(field){
var val=this.getValue ();
if (val.length>6){
Ext.Ajax.request({
url: 'my.php',
success: function(response){
return response.responseText; // php return message ' not valid,error'
}
})
}
return true;
}
})
It is not work. TextField always valid. But next code is work:


var myTxtf = new Ext.form.TextField ({
validator: function(field){
var val=this.getValue ();
if (val.length>6){
return ' not valid,error';
}
return true;
}
})

Why this? What problem?
I know - problem in synchronous...but what to do?..
Sorry for my english :)

Gary Schlosberg
7 Apr 2016, 6:51 AM
Here's some threads that might help:
https://www.sencha.com/forum/showthread.php?119447
https://www.sencha.com/forum/showthread.php?19112