Search code examples
javascriptdynamics-crmdynamics-crm-4

Hide a section in MS CRM form which contains read only field


Javascript

I have code that will hide various sections in a MS CRM form based on the value of a Picklist. The code executes in the onChange event of the Picklist. It hides the section by referencing a field in the section and then navigating up the DOM using the ParentElement syntax, as such:

crmForm.all.fieldName.parentElement.parentElement.parentElement.style.display = 'none';

This seems to work, with 1 exception. The offending section has a single read-only field, which I assume is the cause. No error is thrown. I've also tried variations with 2 and 4 ".parentElement" blocks.

How can I hide this section?


Solution

  • 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