dzwillia
12 Feb 2010, 11:58 AM
Hello,
I ran across an instance where I wanted to create a TextArea without any border or background color. I tried using the 'cls' as well as the disableClass (I don't want the text editable) config to specify the style. The color CSS worked, however the border and background-image CSS did not work (across all browsers). However, explicitly specifying the 'style' in the config did work. I didn't have a chance to test all CSS styles would potentially override the default styles for the TextArea, but at least these two are not being overridden properly. It seems to me that these extra CSS classes should function the same for a TextArea as they do for a TextField. I've attached a set of screenshots documenting the differences between the way these CSS styles work for a text field vs. a text area. In addition to the screenshots included, I also tested the following scenarios which I couldn't include screenshots for due to a 5 attachment limit:
- Safari 4.0.4 (Mac): same results as Chrome 5.0 Beta (Mac)
- Firefox 3.6 (Windows): same results as Firefox 2.0.0.20 (Windows)
- IE6 (Windows): same results as IE7 (Windows)
Tested on Ext JS 3.x (3.0, 3.1 and 3.1.1).
CSS:
.test {
border: 0;
background-image: none;
color: #ff0000;
}Javascript:
new Ext.form.FormPanel({
title: "Panel #1: Testing textfield and textarea with cls: 'test'",
renderTo: Ext.getBody(),
width: 680,
padding: 10,
items: [{
xtype: "textfield",
fieldLabel: "Text Field",
width: 550,
value: 'Textfield sample text',
cls: 'test'
},{
xtype: 'textarea',
fieldLabel: "Text Area",
width: 280,
value: 'Textarea sample text',
cls: 'test'
}]
});
new Ext.form.FormPanel({
title: "Panel #2: Testing disabled textfield and disabled textarea with disabledClass: 'test'",
renderTo: Ext.getBody(),
width: 680,
padding: 10,
items: [{
xtype: "textfield",
fieldLabel: "Text Field",
width: 550,
value: 'Textfield sample text',
disabled: true,
disabledClass: 'test'
},{
xtype: 'textarea',
fieldLabel: "Text Area",
width: 280,
value: 'Textarea sample text',
disabled: true,
disabledClass: 'test'
}]
});
new Ext.form.FormPanel({
title: "Panel #3: Testing textfield and textarea with 'style' set",
renderTo: Ext.getBody(),
width: 680,
padding: 10,
items: [{
xtype: "textfield",
fieldLabel: "Text Field",
width: 550,
value: 'Textfield sample text',
style: 'border: 0; background-image: none; color: #ff0000'
},{
xtype: 'textarea',
width: 280,
fieldLabel: "Text Area",
value: 'Textarea sample text',
style: 'border: 0; background-image: none; color: #ff0000'
}]
});
I ran across an instance where I wanted to create a TextArea without any border or background color. I tried using the 'cls' as well as the disableClass (I don't want the text editable) config to specify the style. The color CSS worked, however the border and background-image CSS did not work (across all browsers). However, explicitly specifying the 'style' in the config did work. I didn't have a chance to test all CSS styles would potentially override the default styles for the TextArea, but at least these two are not being overridden properly. It seems to me that these extra CSS classes should function the same for a TextArea as they do for a TextField. I've attached a set of screenshots documenting the differences between the way these CSS styles work for a text field vs. a text area. In addition to the screenshots included, I also tested the following scenarios which I couldn't include screenshots for due to a 5 attachment limit:
- Safari 4.0.4 (Mac): same results as Chrome 5.0 Beta (Mac)
- Firefox 3.6 (Windows): same results as Firefox 2.0.0.20 (Windows)
- IE6 (Windows): same results as IE7 (Windows)
Tested on Ext JS 3.x (3.0, 3.1 and 3.1.1).
CSS:
.test {
border: 0;
background-image: none;
color: #ff0000;
}Javascript:
new Ext.form.FormPanel({
title: "Panel #1: Testing textfield and textarea with cls: 'test'",
renderTo: Ext.getBody(),
width: 680,
padding: 10,
items: [{
xtype: "textfield",
fieldLabel: "Text Field",
width: 550,
value: 'Textfield sample text',
cls: 'test'
},{
xtype: 'textarea',
fieldLabel: "Text Area",
width: 280,
value: 'Textarea sample text',
cls: 'test'
}]
});
new Ext.form.FormPanel({
title: "Panel #2: Testing disabled textfield and disabled textarea with disabledClass: 'test'",
renderTo: Ext.getBody(),
width: 680,
padding: 10,
items: [{
xtype: "textfield",
fieldLabel: "Text Field",
width: 550,
value: 'Textfield sample text',
disabled: true,
disabledClass: 'test'
},{
xtype: 'textarea',
fieldLabel: "Text Area",
width: 280,
value: 'Textarea sample text',
disabled: true,
disabledClass: 'test'
}]
});
new Ext.form.FormPanel({
title: "Panel #3: Testing textfield and textarea with 'style' set",
renderTo: Ext.getBody(),
width: 680,
padding: 10,
items: [{
xtype: "textfield",
fieldLabel: "Text Field",
width: 550,
value: 'Textfield sample text',
style: 'border: 0; background-image: none; color: #ff0000'
},{
xtype: 'textarea',
width: 280,
fieldLabel: "Text Area",
value: 'Textarea sample text',
style: 'border: 0; background-image: none; color: #ff0000'
}]
});