PDA

View Full Version : how should i orgnize my code without a sync request?



icedtiger
6 May 2010, 10:47 PM
Ext.onReady(function() {
var vtypetest = new Ext.util.DelayedTask(function(value, field) {
Ext.Ajax.request({
url: 'Handler.ashx',
autoAbort: true,
success: function(response, options) {
var obj = Ext.decode(response.responseText);
if (obj.success) {
return true;
} else {
return false;
}
}
});
return ???; // here is the problem?
});
Ext.apply(Ext.form.VTypes, {
nameCheck: function(value, field) {
return vtypetest.delay(800, null, null, [value, field])
},
nameCheckText: 'title exists',
nameCheckMask: /[^.]/i
});
var myFormPanel = new Ext.form.FormPanel({
title: 'form',
height: 'auto',
width: '280',
items: [{
xtype: 'textfield',
fieldLabel: 'name',
name: 'name',
vtype: 'nameCheck',
validateOnBlur: false,
validationDelay: 800
}],
renderTo: 'testdivid'
});
});


thanks

Animal
6 May 2010, 11:22 PM
Always return valid from the function. Explicitly mark the field invalid in the success handler depending on what got sent back.

Condor
6 May 2010, 11:26 PM
So you are looking for remote validation (http://www.extjs.com/forum/showthread.php?19112-New-Remote-Field-Validation-Plugin)?

icedtiger
7 May 2010, 12:47 AM
Haha,thanks.
Just what I want.

But i still has that sync request question,
and how can I disable the XXXmask?