1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    275
    Vote Rating
    0
    Rafael is on a distinguished road

      0  

    Default [RESOLVED]KeyPress -- Need to return false when CAPSLOCK active

    [RESOLVED]KeyPress -- Need to return false when CAPSLOCK active


    Code:
       keypress: function(e) {
                var charCode = e.getCharCode();
                if(
                    (e.shiftKey && charCode >= 97 && charCode <= 122) ||
                    (!e.shiftKey && charCode >= 65 && charCode <= 90)
                ){
                    if (this.showCapsWarning) {
                        this.showWarning(e.target);
                    }
                    return false;
                } else {
                    this.hideWarning();
                }            
            },
    this return false dont stop a write

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Try:
    Code:
    e.stopEvent();

  3. #3
    Ext User
    Join Date
    Feb 2008
    Posts
    275
    Vote Rating
    0
    Rafael is on a distinguished road

      0  

    Default


    Condor,
    Code:
    e.stopEvent();
    dont stop !

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    On which browser?

    ps. For IE you sometimes have to add:
    Code:
    if(Ext.isIE) {e.browserEvent.keyCode = 0;}

  5. #5
    Ext User
    Join Date
    Feb 2008
    Posts
    275
    Vote Rating
    0
    Rafael is on a distinguished road

      0  

    Default


    Condor this
    Code:
    e.stopEvent();
    and this
    Code:
    if(Ext.isIE) {e.browserEvent.keyCode = 0;}
    work !

    Need to verify if user press SHIFT, how ?

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    It works on my Firefox...

    Code:
    var t = new Ext.form.TextField({
    	enableKeyEvents: true,
    	listeners: {
    		keypress: function(f, e){
    			var charCode = e.charCode;
    			if((e.shiftKey && charCode >= 97 && charCode <= 122) ||
    				(!e.shiftKey && charCode >= 65 && charCode <= 90)){
    				e.stopEvent();
    			}
    		}
    	}
    });

  7. #7
    Ext User
    Join Date
    Feb 2008
    Posts
    275
    Vote Rating
    0
    Rafael is on a distinguished road

      0  

    Default


    is here dont work with SHIFT and work with CAPSLOCK
    Code:
     new Ext.form.TextField({
    	enableKeyEvents: true,
    	listeners: {
    		keypress: function(f, e){
    			var charCode = e.charCode;
    			if((e.shiftKey && charCode >= 97 && charCode <= 122) ||
    				(!e.shiftKey && charCode >= 65 && charCode <= 90)){
    				e.stopEvent();
    			}
    		}
    	}
    });

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    I don't understand... Which keys do you want to block?
    - Normal keys
    - Shifted keys
    - Normal keys with Caps-Lock
    - Shifted keys with Caps-Lock

  9. #9
    Ext User
    Join Date
    Feb 2008
    Posts
    275
    Vote Rating
    0
    Rafael is on a distinguished road

      0  

    Default


    - Shifted keys
    - Normal keys with Caps-Lock

  10. #10
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    86
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    So you don't want to block Caps-Lock at all! You want to block uppercase!

    Try:
    Code:
    var t = new Ext.form.TextField({
    	enableKeyEvents: true,
    	listeners: {
    		keypress: function(f, e){
    			var charCode = e.charCode;
    			if(charCode >= 65 && charCode <= 90){
    				e.stopEvent();
    			}
    		}
    	}
    });
    which can be simplified to:
    Code:
    var t = new Ext.form.TextField({
    	maskRe: /[^A-Z]/
    });
    Or, to also handle pasted uppercase text:
    Code:
    var t = new Ext.form.TextField({
    	maskRe: /[^A-Z]/,
    	processValue: function(value){
    		value = this.constructor.prototype.processValue.call(this, value);
    		var newValue = value.toLowerCase();
    		if(newValue !== value){
    			this.setRawValue(newValue);
    			return newValue;
    		}
    		return value;
    	}
    });

Thread Participants: 1

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