PDA

View Full Version : How to set background of Ext-JS 4 TextField Widget when receive focus?



Bill M
15 Dec 2012, 12:28 PM
Hi,

Was looking for a possible example of how to set the background color a textField widget when it receives focus. Would anyone have any sample code or point me to an example that shows how to do this?

I didn't see examples in the Ext-JS 4.1 samples from the distribution that shows how to do this.

Would I need to Extend the Class, or could I have a simple event handler to pickup the event? A real Newbie here to Ext-JS and JavaScript. Would appreciate any example code.


Thanks!

slemmon
15 Dec 2012, 2:09 PM
Focusing on the field applies a CSS class of x-form.focus to the form field.
By default that sets "background-color: #7EADD9;"

You can write your own rule for x-form-focus if you want and then the style will be whatever you set it to on focus (may have to include some !important here and there override any existing styles for the field).