dorgan
30 Dec 2011, 10:37 AM
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.....
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');
}
}
})
});
Maybe this is will same someone else the time of trying to put this together.....
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');
}
}
})
});