Results 1 to 2 of 2

Thread: vtypes with more params

  1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    60

    Default vtypes with more params

    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) {
    Ext.Ajax.request({
    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?

  2. #2
    Sencha User
    Join Date
    Mar 2008
    Posts
    566

    Default

    not sure what you are trying to do. I have added some custom properties to my fields and use them in my vtype

    Code:
    Ext.apply(Ext.form.VTypes, {
    	UniqueField: function (value, field){
    		//console.log(field);
    		if(!field.currentValue){
    			Ext.apply(field, {originalValue: value});
    			Ext.apply(field, {currentValue: ''});
    			Ext.apply(field, {currentValidationStatus: true});
    		}
    		var validfield = field.currentValidationStatus;
    		if(field.currentValue!=value){
    			Ext.Ajax.request({
            		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);
    					if(obj.success==true){
              				field.clearInvalid();
    						field.currentValidationStatus = true;
    						validfield = true;
    					}else{
    						field.markInvalid(obj.error.reason);
    						field.vtypeText = obj.error.reason;
    						field.currentValidationStatus = false;
    						validfield = false;
    					}
            		},
                	failure: function (response, options) { 
    					return false
             		}
           		});
    		}
    		field.currentValue = value;
    		return validfield;
     	}
    });

Similar Threads

  1. Replies: 0
    Last Post: 20 Jul 2010, 3:28 PM
  2. Replies: 0
    Last Post: 20 Jul 2010, 3:08 PM
  3. Submit params of a store (last load params)
    By BKrisz79 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 20 Jul 2009, 12:34 PM
  4. Url Params in store.load({params})
    By sKuD24 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 12 Sep 2008, 1:34 AM
  5. pre-building params for load({params:})??
    By benny in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 24 May 2007, 3:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •