PDA

View Full Version : DisabledCls for dynamically added textfields not working ?



drunkmoose
30 Jun 2014, 7:13 AM
Hello

I'm adding fields to a fieldset as such:



renderContactFormFields: function (window) {

var fieldSet = window.down('form').down('fieldset');


var readOnlyCss;
var fieldSetItem;


for (var i = 0; i < window.fieldsToRender.length; i++)
{
var col = window.fieldsToRender[i];
var readOnlyValue = false;


if (contactFormReadOnlyFields.indexOf(col.dataIndex) != -1)
readOnlyValue = true;


if (!readOnlyValue)
fieldSetItem = { name: col.dataIndex, fieldLabel: col.text, readOnly: readOnlyValue };
else
fieldSetItem = { name: col.dataIndex, fieldLabel: col.text, readOnly: readOnlyValue, disabledCls: 'fieldSetDisabled' };

fieldSet.add(fieldSetItem);
}


window.down('form').loadRecord(window.selectedContact);
}


And the CSS in question is:



.fieldSetDisabled {
background-color: silver !important;
}


This has no effect whatsoever though. Am I doing something wrong ? The CSS above is contained within a package which seems to be correctly loaded by the framework. By inspecting the elements with Chrome's dev tools, I don't see "fieldSetDisabled" anywhere in the "class" attribute of the input.

Thanks.

mitchellsimoens
16 Jul 2014, 9:45 AM
Just from that code, the field isn't disabled.

drunkmoose
16 Jul 2014, 11:54 AM
Thanks Mitchell. That question was answered over at SO. It was mostly a stupid mistake of mine. I confused read only with disabled.

http://stackoverflow.com/questions/24497370/disabledcls-for-dynamically-added-textfields-not-working