Pages

Friday, July 23, 2010

Ext.form.TextField value in uppercase

Hi!

if you want to have a Ext.form.TextField only in uppercase, you can use the following code:

new Ext.form.TextField({
     style : {textTransform: "uppercase"},
     listeners:{
          change: function(field, newValue, oldValue){
                       field.setValue(newValue.toUpperCase());
                  }
     }
});

3 comments:

  1. Hey, thanks! Just what I was looking for!

    ReplyDelete
  2. thanks,this was very helpful :)

    ReplyDelete
  3. Problem with this solution is if the user attempts to type text in the middle of existing text, only first character goes in that location. Remaining text is placed at end (since cursor is reset when you do setValue()

    ReplyDelete