PDA

View Full Version : Checkboxgroup Invalid Background Color



PV-Patrick
22 Dec 2010, 11:45 AM
I don't' know if this has been covered, I've done a bit of searching and couldn't find it but I assume it would be a common problem.

I have a checkboxgroup and when i submit the form and the invalid state comes back for the group, it changes the entire background to white. I know the css that controls this lies in: .x-form-invalid, textarea.x-form-invalid. The problem with overriding that is it will do it for all fields in the form. I have over types that are text boxes that I don't want the BG color to be black like I do on the checkboxgroup. Is there a way to individually set the background color on invalid state for a specific field?

PV-Patrick
24 Dec 2010, 2:50 PM
Anyone have any suggestions on this? I haven't been able to figure out how to change the BG color on invalid state for specific fields. Thanks in advance and Merry Christmas!

aramaki
24 Dec 2010, 4:40 PM
yourMethidName:function(){
this.form.getForm().items.each(function(item) {
var el = item.el;
if (el.getValue() != '') {
el.setStyle({color: 'blue'});
} else {
el.setStyle({color: 'black'});
}
});
}

if you need to appear some action to specific elements, you can check it ID or Name or Xtype

PV-Patrick
24 Dec 2010, 10:29 PM
Thank you very much for the suggestion aramaki! That got me on the right track....

In case anyone else wants to know, I solved it by adding an event listener to the fields that needed to have the BG a different color than all the rest.



listeners : {
invalid : function(field, msg) {
field.getEl().setStyle("background-color", "white");
}
}