Hide section in MS CRM form that contains read-only field
Javascript
I have some code that will hide various sections in an MS CRM form based on a picklist value. The code is executed in the onChange event in the select list. It hides the section by referencing a field in the section and then translates the DOM using the ParentElement syntax as such:
crmForm.all.fieldName.parentElement.parentElement.parentElement.style.display = 'none';
This seems to work, with one exception. The offending section has one read-only field, which I believe is the cause. No error occurs. I've also tried options with 2 and 4 ".parentElement" blocks.
How can I hide this section?
source to share
Take a look at the following post. it uses section position instead of parentElement. http://mscrm4ever.blogspot.com/2008/08/show-hide-crm-form-section.html
source to share
Sorry to buy, can you clear the question? You say this works with one exception where the section is read-only. Is this the field you are trying to work in your example? Or you can work with any field in the section, but if there is read-only in the section, it fails? What's the exception (not working, javascript error)?
source to share