1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    2
    Vote Rating
    0
    Merkaba is on a distinguished road

      0  

    Question TextArea maxLength validation

    TextArea maxLength validation


    Hi all,

    Is there a built in way to stop a user from entering more than the maxLength in a Ext.form.TextArea?

    The built-in validation shows the red outline when it goes over the set maxLength, but it doesn't stop the user from typing more.

    I haven't tried much to fix this as it isn't a high priority issue for the users yet, but it would be nice if I didn't have to plug in a validation function to every TextArea in the app to prevent entering > maxLength characters. I tried the vtypes, and they don't work for this, though the email vtype was a great time saver for email validation. Hopefully I'm just doing something wrong.

    I'm using 2.0 Stable in IE 7.

    Thanks,

    Merk

  2. #2
    Ext User
    Join Date
    Jan 2008
    Posts
    36
    Vote Rating
    0
    Rocketman is on a distinguished road

      0  

    Default


    I am having the same problem with the maxLength in IE. However, FF handles the maxLength just fine. I'm not sure if this is a browser implementation decision or ext issue. If you truely want to restrict the user from typing, you can always define a mask using maskRe.

  3. #3
    Sencha Premium Member
    Join Date
    Jun 2007
    Posts
    59
    Vote Rating
    0
    ftftft is on a distinguished road

      0  

    Default


    I have the same issue at IE. I am using ext js 2.0.1. It said "Line 25566 "Error null is null or not object.

  4. #4
    Ext JS Premium Member
    Join Date
    Nov 2007
    Location
    Cambridge UK
    Posts
    112
    Vote Rating
    0
    hat27533 is on a distinguished road

      0  

    Default This is how I did it

    This is how I did it


    Code:-
    var commentEdit = new Ext.form.TextArea({
    value:'',
    id:'CommentEdit',
    name:'CommentEdit',
    allowBlank:true,
    maskRe:/^([ _a-zA-Z0-9\^\$\.\+\?\=\:\|\\\/\(\)\[\]\&\-])+$/,
    maxLength:200,
    listeners: {
    'keypress': {
    fn: function(field, event) {
    var val = field.getValue();
    if(event.keyCode !=8 && event.keyCode !=46){//ignore backspace and delete
    if (val.length >= 200 ){
    event.stopEvent();
    }
    }
    return;
    }
    ,scope:this
    }
    },
    selectOnFocus: true,
    enableKeyEvents:true
    });

  5. #5
    Sencha User
    Join Date
    Jul 2013
    Posts
    2
    Vote Rating
    0
    akshayan is on a distinguished road

      0  

    Default enforceMaxLength config

    enforceMaxLength config


    Hi ,
    We can use the enforceMaxLength config to restrict the maxlength to achieve this functionality easily.maxLength : 200,
    enforceMaxLength : true,
    Also this will avoid the paste (ctrl+v) problem also.


  6. #6
    Sencha User
    Join Date
    Jul 2013
    Posts
    2
    Vote Rating
    0
    akshayan is on a distinguished road

      0  

    Default


    Hi ,
    Thanks. This listener function working fine. but it could not control the ctrl+v problem. if we paste some contents it does not restrict the limit.

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