PDA

View Full Version : Highlight form TextField in 4.0



bsklar
6 Sep 2011, 11:01 AM
I am trying to highlight the textfield when the focus event is fired. In Ext JS 3.x the following worked:



ccTF = new Ext.form.TextField({
fieldLabel: 'CC',
id: 'cc',
name: 'cc',
anchor: '100%',
onFocus: function(){
this.el.setStyle('background', 'lightblue');
},
onBlur: function(){
this.el.setStyle('background','#FFFFFF');
}
});


In 4.x it is changing the background of the label. I would greatly appreciate any help.

bsklar
6 Sep 2011, 12:26 PM
The fix for 4.x is the following:




ccTF = new Ext.form.TextField({ fieldLabel: 'CC', id: 'cc', name: 'cc', anchor: '100%', onFocus: function(){ this.inputEl.setStyle('background', 'lightblue'); }, onBlur: function(){ this.inputEl.setStyle('background','#FFFFFF'); } });