-
30 Dec 2011 10:37 AM #1
form.Field Override
form.Field Override
I put together this simple override that will add a class to a form fields label on focus. The way I used it was i made the default text color of field labels lighter and made it so the focus class has a darker color.
Maybe this is will same someone else the time of trying to put this together.....
Code:Ext.override(Ext.form.Field, { onFocus: Ext.form.Field.prototype.onFocus.createSequence(function () { var formItem = this.el.up('.x-form-item', 10); if (formItem) { var label = formItem.child('.x-form-item-label'); if (label) { label.addClass('x-form-item-label-focus'); } } }), onBlur: Ext.form.Field.prototype.onBlur.createSequence(function () { var formItem = this.el.up('.x-form-item', 10); if (formItem) { var label = formItem.child('.x-form-item-label'); if (label) { label.removeClass('x-form-item-label-focus'); } } }) });
-
30 Dec 2011 11:08 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
Very nice!
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.





Reply With Quote