Trying to make a selection of fields read only using a button or checkbox. Can anyone help me?
I'm new to JS, learning as i go, and i'm stuck on this one. Hopefully someone could help?
This is the script I currently have:
var fieldsToLock = ["Text2", "Text1", "Text3", "Text4", "Text5", "ComboBox6", "MRcheck", "CustomerCheck", "Other2check", "SubCombo", "RadCombo", "ProcCombo", "ForCombo", "BackCombo", "BordCombo", "MounCombo", "Text39", "Text7", "Customchk", "exttypecombo", "extforecombo", "extbackcombo", "extlogocombo", "extchevcombo", "exttapercombo", "extmoutcombo", "extSSchk", "extDSchk", "extaddition", "Text32", "decRadCombo", "decProcCombo", "decBordCombo", "decText39", "Text41", "UpholsteryCombo", "Fencelength", "fencebetween", "Text47", "Text48", "Text6", "Text8", "CheckBox9", "CheckBox10", "sizefield", "sizefieldother", "sizefielddec", "Text10", "Text11", "Text12", "Text13", "Text14", "Text15", "flatSSchk", "flatDSchk", "heightdecfield", "heightotherfield", "heightfieldflat", "bannerheight", "Text41", "fenceheightfield", "ReflectivityCombo", "OverlayCombo", "Text1", "decForCombo", "decBackCombo", "decRadCombo", "decProcCombo", "banText39", "FlatCheck", "ExtCheck", "DecalCheck", "BannerCheck", "Other1check", "Text17", "Text91", "Text101", "Text111", "CheckBox11" ];
for (var i in fieldsToLock) this.getField(fieldsToLock).readonly = true;
There are a lot of fields to be made read only, but there are some not shown here, which i need to stay writable. It works for about 75% of the fields but not the others. I've checked all the names are correct. What else could be causing this? And is there any way around the problem?
