View Full Version : Apply my own css class to a TexField

26 Mar 2009, 9:22 AM
I have to apply a css class to a TextField when its disabled with the property disabledClass My css class is :
.fieldForm-disabled {color:black;

But when I see it on firebug the property color and cursor are with line-through so these properties are not applied because other styles are overriding these properties. How to apply them with a css class.


26 Mar 2009, 9:27 AM
Might be able to apply custom styles by using the style: property.

Refer to:
http://extjs.com/deploy/dev/docs/ (http://extjs.com/forum/../deploy/dev/docs/)
L form
L TextField

style : String
A custom style specification to be applied to this component's Element. Should be a valid argument to Ext.Element.applyStyles (http://extjs.com/forum/../deploy/dev/docs/output/Ext.Element.html#applyStyles).
Hope this helps,

26 Mar 2009, 11:54 PM
I have tried to apply this style to a ComboBox with the next line:
I have tried to apply this but I dont see the atributte style in firebug. Thanks

27 Mar 2009, 12:30 AM
Think about what you just wrote.

Read the docs for Ext.apply.

You have copied properties into fechaField. What can simply setting property values in a javascript object do?

If you want to set Style on a Component's Element, you have to call a method.

27 Mar 2009, 4:54 AM
Which method should I use to set a style to a Component? I have been looking for it in the api but I havent seen it


27 Mar 2009, 6:56 AM
OK, All Components have an Element. They must, we're just writing an HTML page.

Get the Element from the Component using getEl()

Then, you have an Ext.Element. Look at the APi docs for it and see what you might be able to use.

30 Mar 2009, 7:18 AM
Ok. My problem now is that I get the element of a textField, and I do element.setOpacity(1). But when I see it in furebug the textField is represented by an "input ..." which opacity is set to 1 but this input is inside a div which opacity is still 0.6 so I dont get what I want. Thanks

30 Mar 2009, 7:21 AM
You're going to have to tell us what you want!

30 Mar 2009, 7:23 AM
Sorry, I have seen the method parent in Element. I think it is the way to get the div and set the opacity of this div, right?is not there other more direct way to get it?Thanks

30 Mar 2009, 7:38 AM
So you want to set the opacity of a whole form item including the label and the input field? Is that what you want?

30 Mar 2009, 10:40 PM
I want the opacity for a whole text field(not the label), but this this textfield in firebug is represented by a input and this input is included in a div. The problem was that I wanted the textfield to have a opacity of 1 but this opacity was set only for the input and not for the div that included this input. I got the parent element and set the opacity of it to 1. I have a checkbox now with opacity 1 too but is doesnt have the same looking than the rest of the textfields and the oapcity is the same.