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?

+1


source to share


3 answers


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



+1


source


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)?



0


source


The previous hiding suggestion by section # will work. Or you can also try using fieldname_c instead of the field name (and it only needs 2 parent elements). _c is the "comment" (label) for the field and should be a little more consistent.

0


source







All Articles