View Full Version : vtypes with more params

28 Nov 2010, 2:58 AM
I want to implement a new vtype with params additionally to the form field value for a database check with dates

like this:

Ext.apply(Ext.form.VTypes, {
'dateAvailable': function(val) {
url: 'datecheck',
method: 'POST',
params: 'date=' + val,
success: function(o) {

The params shall be in my case a type as String and an id as Integer.

But how can I implement these two params in the Ext.apply?

The problem is: Both param values are not globally, but in an Ext.extend from Window as config-Parameters. The form who uses this new vtype is also in it in the initComponent-method

Here the code:

App.publisherRevenueShareEdit.window = Ext.extend(App.ux.window, {
type: null
,id: null

,initComponent: function() {
this.items = [{
xtype : 'form'
,items: [{
xtype: 'datefield',
vtype: dateAvailable

var win = new App.publisherRevenueShareEdit.window({type: 'Test', id: 1});

Can anybody help me?

29 Nov 2010, 5:21 AM
not sure what you are trying to do. I have added some custom properties to my fields and use them in my vtype

Ext.apply(Ext.form.VTypes, {
UniqueField: function (value, field){
Ext.apply(field, {originalValue: value});
Ext.apply(field, {currentValue: ''});
Ext.apply(field, {currentValidationStatus: true});
var validfield = field.currentValidationStatus;
url: 'includes/remote-validator-UniqueField.asp',
method: 'POST',
disableCaching : true,
async: false,
params: {
'UniqueField': value,
'OriginalValue': field.originalValue,
'FieldID': field.moegalId
//'FieldID': field.id
success: function (response, options) {
var obj = Ext.decode(response.responseText);
field.currentValidationStatus = true;
validfield = true;
field.vtypeText = obj.error.reason;
field.currentValidationStatus = false;
validfield = false;
failure: function (response, options) {
return false
field.currentValue = value;
return validfield;