1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    17
    Answers
    1
    Vote Rating
    -1
    chaostimmy is an unknown quantity at this point

      0  

    Default Answered: Passing VTypes the current Formfield

    Answered: Passing VTypes the current Formfield


    Heya, i want to use VTypes but need the Formfield that is currently being validated..

    in the VType example (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.VTypes) is shown the following:
    Code:
    // custom Vtype for vtype:'time'
    var timeTest = /^([1-9]|1[0-9]):([0-5][0-9])(\s[a|p]m)$/i; 
    Ext.apply(Ext.form.field.VTypes, {
        //  vtype validation function
         time: function(val, field) {
             return timeTest.test(val);
         },
         // vtype Text property: The error text to display when the validation function returns false
         timeText: 'Not a valid time.  Must be in the format "12:34 PM".',
         // vtype Mask property: The keystroke filter mask
         timeMask: /[\d\s:amp]/i
     });
    But when I try that, the field argument is always empty....

    solutions? suggestions?

  2. This seems to work, please check on your end.

    Code:
    // custom Vtype for vtype:'time'
    var timeTest = /^([1-9]|1[0-9]):([0-5][0-9])(\s[a|p]m)$/i;
    Ext.apply(Ext.form.field.VTypes, {
        //  vtype validation function
        time: function(val, field) {
        	console.log(field);
            return timeTest.test(val);
        },
        // vtype Text property: The error text to display when the validation function returns false
        timeText: 'Not a valid time.  Must be in the format "12:34 PM".',
        // vtype Mask property: The keystroke filter mask
        timeMask: /[\d\s:amp]/i
    });
    
    Ext.onReady(function(){
    
    	Ext.create('Ext.form.field.Text', {
    	    fieldLabel: 'Departure Time',
    	    name: 'departureTime',
    	    vtype: 'time', // applies custom time validation rules to this field
    	    renderTo: Ext.getBody()
    	});
     
    });
    Regards,
    Scott.

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Answers
    656
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      1  

    Default


    This seems to work, please check on your end.

    Code:
    // custom Vtype for vtype:'time'
    var timeTest = /^([1-9]|1[0-9]):([0-5][0-9])(\s[a|p]m)$/i;
    Ext.apply(Ext.form.field.VTypes, {
        //  vtype validation function
        time: function(val, field) {
        	console.log(field);
            return timeTest.test(val);
        },
        // vtype Text property: The error text to display when the validation function returns false
        timeText: 'Not a valid time.  Must be in the format "12:34 PM".',
        // vtype Mask property: The keystroke filter mask
        timeMask: /[\d\s:amp]/i
    });
    
    Ext.onReady(function(){
    
    	Ext.create('Ext.form.field.Text', {
    	    fieldLabel: 'Departure Time',
    	    name: 'departureTime',
    	    vtype: 'time', // applies custom time validation rules to this field
    	    renderTo: Ext.getBody()
    	});
     
    });
    Regards,
    Scott.

  4. #3
    Sencha User
    Join Date
    May 2011
    Posts
    17
    Answers
    1
    Vote Rating
    -1
    chaostimmy is an unknown quantity at this point

      0  

    Default


    oh nooo..

    why does Ext.log(field) say "empty string"
    and
    console.log(field) show the object??



    thank you very much for helping me finding the problem!

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi